What do you want to save?
Add Code snippet
New code examples
-
PHP 2021-09-08 14:31:02
create a user using factory laravel
1. Create a factory: php artisan make:factory ItemFactory --model=Item Import Illuminate\Database\Eloquent\Factories\HasFactory trait to your model: use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; c... Add solution -
PHP 2021-08-28 04:46:01
must return a relationship instance, but "null" was returned. Was the "return" keyword used? in file /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 492
//ERROR -> ..must return a relationship instance, but "null" was returned. Was the "return" keyword used? in file /home/vagrant/code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.ph... Add solution -
PHP 2021-08-27 14:30:01
how to insert multiple data at a time with create method in laravel
$data = [ ['user_id'=>'Coder 1', 'subject_id'=> 4096], ['user_id'=>'Coder 2', 'subject_id'=> 2048], //... ]; Model::insert($data); // Eloquent approach DB::table('table')->insert($data); // Query Builder approach Add solution
Best helpers
Ranking is empty