laravel中使用软删除

在模型层中(Models)添加三行代码搞定

use  Illuminate\Database\Eloquent\SoftDeletes;

use  SoftDeletes;

protected  $dates=['delete_at'];

具体用法:

namespace  App\Models;

use  Illuminate\Database\Eloquent\Model;

use  Illuminate\Database\Eloquent\SoftDeletes;

class  RelStudentState  extends  Model

{

useSoftDeletes;

protected  $table='rel_student_state';

protected  $fillable=['student_guid','state'];

protected  $hidden=['created_at','updated_at','deleted_at'];

protected  $dates=['delete_at'];

}

你可能感兴趣的:(laravel中使用软删除)