- db: users
- table: contacts
- id
- name
- phone
- address
- city
- state
- zip
Created
December 8, 2015 16:03
-
-
Save bbatsche/a33fb232018e357c0ace to your computer and use it in GitHub Desktop.
file: Model.php
- class Model {}
file: User.php
- class User extends Model{}
file: contacts.php -this is the procedural code
e.g. of consuming class
// New record $contact = new User(); $contact->email = '[email protected]'; $contact->name = 'Isaac'; $contact->phone = '210-555-5555';
// Find one $user = User::find(35);
// Find all $users = User::all(); foreach($users as $user) { echo $user->name; }
// Updating $user = User::find(25); $user->name = 'Consuelo'; $user->save();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ben, Issac wanted us to take a look at this part of the curriculum and potentially re-design it to be more clear and offer a more accurate description of what is being done.
I have a few thoughts, but I just wanted to give you a heads up that this was here.