Laravel 5’s Soft delete

Laravel 5’s Eloquent has a function called SoftDeletes that performs logical deletion instead of physically deleting data from a DB table.

If you do this soft delete, data will not be deleted from the table but it will not be able to be pulled by ordinary SELECT etc. It will behave the same as deleting it.
This function allows you to extract information once it is deleted, when it is needed again.

なるほどー、これ結構便利かも。

use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Eloquent {
	use SoftDeletes;

	protected $dates = ['deleted_at'];
}

モデルに上記のように記述を追加し、SoftDeletesを使えるようにする。削除された場合は、deleted_atカラムにタイムスタンプがセットされる。

なるほどね。