Skip to content

Instantly share code, notes, and snippets.

@Garbee
Created October 7, 2013 21:12
Show Gist options
  • Save Garbee/6875041 to your computer and use it in GitHub Desktop.
Save Garbee/6875041 to your computer and use it in GitHub Desktop.
Tinker quick tip.

Laravel has an awesome command called "tinker". This is just a really quick way for you to interact with your application in the command line. It has a great use for debugging new models. Let's check out a quick example:

php artisan tinker

You are now dropped into a PHP terminal. Here you can input whatever you want to execute, like the following.

$user = new User;
$user->first_name = Adam;
$user->last_name = Spinner;
$user->exp = 9001;
$user->save();

All of this will execute just like normal PHP. You can then var_dump $user to check out what its state is. Play around with this amazing toy of the command line and spread the use-cases you find around.

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