軟刪除並不是真的刪除資料庫裡的資料,而是讓他無法被一般SELECT或是其他方式get到 要做軟刪除需要先在資料表中建立`deleted_at`欄位  再在`Model`裡加入`use SoftDeletes` ```php! use Illuminate\Database\Eloquent\SoftDeletes; class DealerAttributes extends Base { use SoftDeletes; protected $dates = ['deleted_at']; public function del() { DEL::find(1)->delete(); } } ``` 被軟刪除的資料,`deleted_at`欄位就會顯示刪除時間  >⚠️ 注意:`deleted_at`欄位只要不是`NULL`都會被判定為軟刪除,包括 '0000-00-00 00:00:00' 其他更多方法:[Larvel](https://laravel.tw/docs/4.2/eloquent#soft-deleting)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up