eloquent - Record Not Being Deleted In Laravel -
hello having weird issue not understand, trying delete record in laravel. destroy method in resource controller:
public function destroy($id) { $ins = institution::find($id); $success = $ins->delete(); return [ 'success' => $success ]; }
this model:
namespace app\models; use illuminate\database\eloquent\model; use illuminate\database\eloquent\softdeletingtrait; class institution extends model { use softdeletingtrait; protected $dates = ['deleted_at']; protected $table = 'sys_institutions'; }
now success returns true indicating record indeed has been deleted when check db not case.
i have tried returning $ins after delete well, column deleted_at seems have date not saved database. in database table deleted_at null.
now did not create tables migrations dunno if might have current problem.
i have checked $id , indeed correct.
i have tried using:
$success = institution::destroy($id);
that didn't work either.
Comments
Post a Comment