We’ll go into the command line:
php artisan tinker
Now find a record:
$post = App\Models\Post::find(3);
Update like this:
$post->title = "hi"
$post->content = "hi"
In order to save to database write:
$post->save();
To soft delete you just need one line like so:
$post->delete()
To permanently delete this:
$post = App\Models\Post::onlyTrashed()
This will give you an Eloquent Builder response. If you write $post
you’ll see it again
Now permanently delete:
$post->forceDelete()