delete record laravel code example
Example 1: laravel delete where
DB::table('users')->where('id', $id)->delete();
Example 2: laravel fillable
protected $fillable = [
'title',
'slug',
'body',
'image',
'published',
'comments_open'
];
Example 3: laravel create or update
$flight = App\Models\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99, 'discounted' => 1]
);
Example 4: laravel update
$flight = App\Models\Flight::find(1);
$flight->name = 'New Flight Name';
$flight->save();