Skip to content

Instantly share code, notes, and snippets.

@bbatsche
Created December 8, 2015 16:03
Show Gist options
  • Save bbatsche/a33fb232018e357c0ace to your computer and use it in GitHub Desktop.
Save bbatsche/a33fb232018e357c0ace to your computer and use it in GitHub Desktop.

Create migration

  • db: users
  • table: contacts
    • id
    • email
    • name
    • phone
    • address
    • city
    • state
    • zip

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 = 'isaac@codeup.com'; $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();

@BobFromAccounting
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment