How to perform a delete operation on a Model?

in Laravel 5 you can use the destroy method.

$user->destroy($id);

and, sure, you have a command line to do so.

$ php artisan tinker

and you can run for example

>> $var = new App\User;
>> $user= $user->find($id);
>> $user->destroy();

Several ways to do this.

If your controller defines the user as an argument:

public function destroy(User $user) 
{
    return $user->delete();
}

You can also delete any user by $id:

User::destroy ($id);

Assuming you're wrapping these routes with some security.

Edit: Corrected spelling


You can put this code for example in controller.

You can use

$user = User::find($id);    
$user->delete();

if you don't use SoftDeletingTrait trait or

$user = User::find($id);    
$user->forceDelete();

if you do, and you want to really remove user from database, not just hide it from results.

More you can read at Laravel page