Reputation: 360
I have a user grid with an editable datetime column. When i edit and save the date time i am updating the date value in my db using a put method and controller. But after successful save the error toaster is being shown without any message.
Laravel Version: 6.2.44
PHP Version:7.2
Laravel-admin: 1.7
Grid : $grid->column('send_date', trans('custom.send_date'))->editable('datetime');
Route : $router->put('user/{id}','UserController@updateDeclarationDate');
UserController:
function updateDeclarationDate($id)
{
$user= User::where('id','=',$id)->first();
if(!empty(request('value'))){
$declarationDate = request('value');
$user->send_date = $declarationDate;
$user->save();
}
}
Upvotes: 0
Views: 439
Reputation: 1676
Your function has no return value, so toastr automatically thinks it failed.
Try adding a return statement at the end of it:
function updateDeclarationDate($id)
{
$user= User::where('id','=',$id)->first();
if(!empty(request('value'))){
$declarationDate = request('value');
$user->send_date = $declarationDate;
$user->save();
}
return [“status” => true, “message” => “your popup message“, “display” => []];
}
Upvotes: 0