April 2015
Beginner
144 pages
3h 13m
English
Applications that display data are great, but they're not very interactive. The fun comes when you allow users to submit data, whether these users are trusted contributors adding content via a content management system or contributions from general users on a site like Wikipedia.
When you retrieve a record via Eloquent, you can access its properties as follows:
$cat = Cat::find(1); print $cat->name;
We can update attribute values in the same manner:
$cat->name = 'Garfield';
This will set the value in the model instance, but we need to persist the change to the database. We do this by calling the save method afterwards:
$cat->name = 'Garfield'; $cat->save();
If you have a table with lots of columns, then it will become tiresome to assign ...
Read now
Unlock full access