Any error whole storing ?
Specific user as in?
What, in your opinion, should I change about this?
Should I Move the Entire Query to Product Model?
Any error whole storing ???
It doesn’t error
No

Pv?
Well
Can you help me
Ok
Specific user as in??
I create model post and when I post I want that post relate to the user auth too
Suppose you have a $user_id column in the post tables, and your user is logged in. Then you would want something like this in your store() method
$post[‘user_id’] = Auth::user()->id();
$post[‘user_id’] = Auth::user()->id();
it’s don’t have id() methods brother

Migration is not happening, I made a mistake

Migration is not happening, I made a mistake
The reason is right in front of you. “Users table already exist”

Migration is not happening, I made a mistake
It’s either you refresh your migration or you use another table name

This is my code:
function wipe_data() {
DB::beginTransaction();
$adminData = User::where(‘role’, ‘admin’)->first();
try {
User::truncate();
User_details::truncate();
User_kyc::truncate();
Token::truncate();`enter code here`
$auto_id = date(‘Y’);
DB::statement(“ALTER TABLE ls_users AUTO_INCREMENT = $auto_id”);
$admin = new User();
$admin->username = $adminData->username;
$admin->email = $adminData->email;
$admin->password = $adminData->password;
$admin->role = $adminData->role;
$admin->save();
$user_id = User::where(‘role’, ‘admin’)->value(‘id’);
DB::commit();
} catch (Exception $ex) {
dd($ex);
DB::rollback();
return false;
}
return true;
}
error ———————
PDOException
There is no active transaction
——————————-
🙏 help me
Laravel-8

This is my code:
function wipe_data() {
DB::beginTransaction();
$adminData = User::where(‘role’, ‘admin’)->first();
try {
User::truncate();
User_details::truncate();
User_kyc::truncate();
Token::truncate();`enter code here`
$auto_id = date(‘Y’);
DB::statement(“ALTER TABLE ls_users AUTO_INCREMENT = $auto_id”);
$admin = new User();
$admin->username = $adminData->username;
$admin->email = $adminData->email;
$admin->password = $adminData->password;
$admin->role = $adminData->role;
$admin->save();
$user_id = User::where(‘role’, ‘admin’)->value(‘id’);
DB::commit();
} catch (Exception $ex) {
dd($ex);
DB::rollback();
return false;
}
return true;
}
error ———————
PDOException
There is no active transaction
——————————-
🙏 help me
Laravel-8
https://stackoverflow.com/questions/67198158/there-is-no-active-transaction-when-refreshing-database-in-laravel-8-0-test
Using php 8.0.2 and Laravel 8.37.0, I am running tests where for every test the database data should be refreshed, since there is conflicting data per test (due to unique constraints).
using the in-
For only $15, Charleston_01 will do beauty, cosmetics, lashes and spa logo. | WELCOME TO MY GIG!!!If you want a distinctive, contemporary and stylish logo for your salon, spa or line of cosmetics that people will remember. You’re | Fiverr
Then you can knock me
I will do you for you

Greetings, I have a question.
Consider that we need to refactor some code.
A large query built with Query Builder and modified with Laravel Collections within a controller (in the show method of ProductController). Finally, it creates an array that is added as an attribute to the output of our REST API (in this case, product features such as color, no matter).
What, in your opinion, should I change about this?
Should I Move the Entire Query to Product Model? or should it be left in the controller here? Do you have any suggestions for improving this piece?
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.

You can make a class just to return the response in the API, something like the Api Response that Laravel have.
Something like repository pattern
You right

it’s don’t have id() methods brother
Use it without the parentheses