Jump to content

Record update problem


ali_254

Recommended Posts

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 by ali_254
Link to comment
Share on other sites

:psychic:

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...

  • Like 1
Link to comment
Share on other sites

31 minutes ago, requinix said:

:psychic:

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.

error.thumb.jpg.510feb25b0e38a66b568a399d2d4afb1.jpg

 $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 by ali_254
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

 

 

 

 

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.