Tutorial by Examples

Model creation Model classes must extend Illuminate\Database\Eloquent\Model. The default location for models is the /app directory. A model class can be easily generated by the Artisan command: php artisan make:model [ModelName] This will create a new PHP file in app/ by default, which is name...
$user = User::find(1); $user->name = 'abc'; $user->save(); You can also update multiple attributes at once using update, which does not require using save afterwards: $user = User::find(1); $user->update(['name' => 'abc', 'location' => 'xyz']); You can also update a model(s)...

Page 1 of 1