eloquent save code example
Example 1: laravel fillable
protected $fillable = [
'title',
'slug',
'body',
'image',
'published',
'comments_open'
];
Example 2: update query in laravel eloquent
$data = DB::table('cart')
->where('crt_id', $id)
->update(['crt_status' =>'0']);
Example 3: laravel difference between fill and update
<?php$user = User::find(1);
$user->update(['first_name' => 'Braj', 'last_name' => 'Mohan']);
$user->fill(['first_name' => 'Fred', 'last_name' => 'Avad']);
$user->is_active = true;
$user->save();
Example 4: laravel find query
$model = App\Models\Flight::where('legs', '>', 100)->firstOr(function () {
});
Example 5: laravel eloquent fill
$flight->fill(['name' => 'Flight 22']);