It's common that a user in your applications makes mistakes and deletes data by accident – even if you show them countless warnings before they delete the record from your database. In other scenarios you can introduce the concept of a trash that your users know from their desktop and delete trashed records after a while.
Add soft delete to the User model with a new column in the up() method of a new migration: Schema::table('users', function (Blueprint $table) { $table->softDeletes(); }); Add the SoftDeletes trait to the User model: class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable, SoftDeletes; //... } From now on, your application doesn't delete Users from the database anymore when you run the delete method on a user but sets a date when this user got deleted.
User::first()->forceDelete(); If you want to clean up your database regularly and delete soft deleted models automatically, this is called https://laravel.com/docs/8.x/eloquent#pruning-models.