softdeleteとは?
聞きなれない言葉ですが、論理削除の意味です。
論理削除とは、表面上は削除されるが、データはテーブルに残っている状態
migrationで、softdeletesメソッドを呼び出し、use softdetesとします。
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Post extends Model
{
    //
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    // protected $table = 'posts'; 
	protected $fillable = [
		'title',
		'content'
	];
}
さらにmigrationファイルを追加
public function up()
    {
        Schema::table('posts', function (Blueprint $table) {
            //
            $table->softDeletes();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('posts', function (Blueprint $table) {
            //'
                        $table->dropColumn('deleted_at');
        });
    }
route
Route::get('/softdelete', function(){
		Post::find(1)->delete();
});
mysql> select * from posts;
+—-+——————-+—————————————————+———————+———————+———-+———————+
| id | title             | content                                           | created_at          | updated_at          | is_admin | deleted_at          |
+—-+——————-+—————————————————+———————+———————+———-+———————+
|  1 | Update tile       | Laravel is the best thing that happen to PHP      | NULL                | 2019-12-06 05:35:12 |        0 | 2019-12-06 05:35:12 |
|  4 | new ORM title 2   | wow eloquent is really cool, look at this content | 2019-12-05 18:23:33 | 2019-12-05 18:33:31 |        0 | NULL                |
|  6 | php create method | Wow I’m learning a lot                            | 2019-12-06 05:09:21 | 2019-12-06 05:09:21 |        0 | NULL                |
+—-+——————-+—————————————————+———————+———————+———-+———————+
3 rows in set (0.00 sec)
アプリケーションでユーザがアカウント削除するが、論理データはテーブルに残す時などに使えそうです。
Route::get('/readofsoftdelete', function(){
		$post = Post::find(1);
		return $post;
});
soft deleteのレコードは、eloquentでfindしようとしても、blank扱いとなります^^
beautiful than expected
Route::get('/readofsoftdelete', function(){
		// $post = Post::find(1);
		// return $post;
		$post = Post::withTrashed()->where('id', 1)->get();
		return $post;
});
[{“id”:1,”title”:”Update tile”,”content”:”Laravel is the best thing that happen to PHP”,”created_at”:null,”updated_at”:”2019-12-06 05:35:12″,”is_admin”:0,”deleted_at”:”2019-12-06 05:35:12″}]
onlyTrashedでsoftdeleted itemを呼び出すこともできる
Route::get('/readofsoftdelete', function(){
		// $post = Post::find(1);
		// return $post;
		// $post = Post::withTrashed()->where('id', 1)->get();
		// return $post;
		$post = Post::onlyTrashed()->where('is_admin', 0)->get();
		return $post;
});