25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Execution<br />

Now that we've set up our new migration, let's run it with this Artisan comm<strong>and</strong>:<br />

$ php artisan migrate<br />

You should see an output like this in the Terminal: Migrating:<br />

2017_06_20_133317_create_listings_table Migrated:<br />

2017_06_20_133317_create_listings_table<br />

To confirm the migration worked, let's use Tinker to show the new table<br />

structure. If you've never used Tinker, it's a REPL tool that allows you to interact<br />

with a <strong>Laravel</strong> app on the comm<strong>and</strong> line. When you enter a comm<strong>and</strong> into<br />

Tinker it will be evaluated as if it were a line in your app code.<br />

Firstly, open the Tinker shell: $ php artisan tinker<br />

Now enter a PHP statement for evaluation. Let's use the DB facade's select method<br />

to run an SQL DESCRIBE query to show the table structure: >>>><br />

DB::select('DESCRIBE listings;');<br />

The output is quite verbose so I won't reproduce it here, but you should see an<br />

object with all your table details, confirming the migration worked.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!