I know there are a lot of answers there about this question but none of them really helped me.
// update name
Route::put('/profile/update', function(Request $request){
$name = $request->input('name');
try{
echo DB::table('users')->where('id',Auth::id())->update(['name' => $name]);
}
catch(\Exception $e){
// do task when error
echo $e->get_message();
}
});
I have also tried delete method but that is also not working can you please figure out what is going on. thanks.
Laravel mostly uses camelCase for nomenclature so use:
catch(\Exception $e){
// do task when error
echo $e->getMessage();
}
If not then just dump full $e
to see it through:
catch(\Exception $e){
// do task when error
dd($e);
}
snake_case nomenclature is only used for table names in Laravel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With