ali_254 Posted July 2, 2021 Share Posted July 2, 2021 (edited) hi,i use Authentication system and want Update record of User is" loggen in" .i use this code $data=User::find(Auth::user()->id); //echo $date; $data->gender=$request->gender; $data->name=$request->username; $data->mobile=$request->mobile; $data->email=$request->email; $data->address=$request->address; $data->image=$request->image; $data->save; return redirect()->route('profile.view')->with('success',' User Updated successfuly'); but dont update this record and dont receive any Error. please guide me Edited July 2, 2021 by ali_254 Quote Link to comment Share on other sites More sharing options...
requinix Posted July 2, 2021 Share Posted July 2, 2021 You know your application and framework (looks like Laravel) better than us so it's not like we can instantly tell you what table and/or column(s) you have to update. If there's a "last logged in" timestamp on the user table then update that. Otherwise... 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted July 2, 2021 Author Share Posted July 2, 2021 (edited) 31 minutes ago, requinix said: You know your application and framework (looks like Laravel) better than us so it's not like we can instantly tell you what table and/or column(s) you have to update. If there's a "last logged in" timestamp on the user table then update that. Otherwise... i want update one record of table in mysql....but my data , dont update and dont receive any Error message. $data=User::find(Auth::user()->id); //echo $date; $data->gender=$request->gender; $data->name=$request->username; $data->mobile=$request->mobile; $data->email=$request->email; $data->address=$request->address; $data->image=$request->image; $data->save; return redirect()->route('profile.view')->with('success',' User Updated successfuly'); code: I used this code for update , Have a Problem? thanks Edited July 2, 2021 by ali_254 Quote Link to comment Share on other sites More sharing options...
requinix Posted July 2, 2021 Share Posted July 2, 2021 $data->save; 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted July 2, 2021 Author Share Posted July 2, 2021 (edited) 10 minutes ago, requinix said: $data->save; What is wrong in line? thanks Edited July 2, 2021 by ali_254 Quote Link to comment Share on other sites More sharing options...
requinix Posted July 2, 2021 Share Posted July 2, 2021 What is "->save", exactly? Try telling me in as much detail as you possibly can what that line is supposed to do. Lots of detail. Like you had to explain it to someone who is new to programming and has very little understanding of how things work. 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted July 2, 2021 Author Share Posted July 2, 2021 i use "save" for Update Fields in "Users" Table thanks . OK...I will explain complete... i use form Authentication system in laravel (Laravel Jetstream). when i add this package in laravel project , add A number migrations in project... i want Edit Table "Users" in this package...so i add How many Field in this thable: (In Previous article Sent Photo from This Table) mobile address gender image So , I decided Update "Users" Table With New Fields. For Update I use from This Syntax: https://laravel.com/docs/8.x/eloquent#updates Quote Link to comment Share on other sites More sharing options...
maxxd Posted July 3, 2021 Share Posted July 3, 2021 From the Laravel documentation: $flight->name = 'Paris to London'; $flight->save(); From your code: $data->image=$request->image; $data->save; Do you see the difference? 1 Quote Link to comment Share on other sites More sharing options...
ali_254 Posted July 3, 2021 Author Share Posted July 3, 2021 4 hours ago, maxxd said: From the Laravel documentation: $flight->name = 'Paris to London'; $flight->save(); From your code: $data->image=$request->image; $data->save; Do you see the difference? oh !! I Dont Use "()" ! The problem was solved! Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.