Update on some Laravel 4.2 fields

Asked

Viewed 74 times

0

I have a table called People in Mysql with 40 fields and I want to update only 2 fields (latitude and longitude) but I don’t want to bring all 40 fields to change together. I just want to save the two camps I mentioned.

$people = DB::table('people')
            ->where('people.id', $people_id)
            ->select('people.id', 'people.latitude', 'people.longitude')
            ->first();

$people->latitude = $latitude;
$people->longitude = $longitude;
$people->save();

How to do this with Laravel 4.2?

  • Translate your question into Portuguese

  • Please do the translation into English

  • It worked for you Bruno?

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.