laravel ehere code example

Example 1: 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

Example 2: wherein laravel

DB::table('user')->whereIn('id', [100,200])->get();

Example 3: scribe laravel

composer require --dev knuckleswtf/scribe

Example 4: scribe laravel

php artisan vendor:publish --provider="Knuckles\Scribe\ScribeServiceProvider" --tag=scribe-config

Tags:

Php Example