public function statusUpdate($id, $status)
{
$adminID = Admin::find($id);
$adminID->user->status = ($status == 1 ? 0 : 1);
$data = (['status' => ($status == 1 ? 0 : 1)]);
$userName = $adminID->user->userName;
$adminID->update($data);
$adminID->save();
session()->flash('flashMessage', $userName . ' Operation Successful');
return redirect()->back();
}
This is my function above but the status is not updating. The Admin and User models are linked using hasMany and belongsTo relationship. it works because am able to get the status from the user table with the relationship
$adminID->user->status
But when i click on the link to change the status it doesn't change. my link is below
<a href="" class="label label-sm label-"></a>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ddcjXa
via IFTTT
Aucun commentaire:
Enregistrer un commentaire