laravel 8 delete by id
//For a User table, to delete ID 1:
$user = User::find(1);
$user->delete();
//OR
User::where('id', 1)->delete();
//OR
User::destroy(1);
//OR
User::destroy([1, 2, 3]); //Delete id 1, 2 and 3
laravel 8 delete by id
//For a User table, to delete ID 1:
$user = User::find(1);
$user->delete();
//OR
User::where('id', 1)->delete();
//OR
User::destroy(1);
//OR
User::destroy([1, 2, 3]); //Delete id 1, 2 and 3
How to remove updated_at or use only created_at laravel eloquent ORM
public $timestamps = ["created_at"]; //only want to used created_at column
const UPDATED_AT = null; //and updated by default null set
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us