This article was published over a year ago, so please be aware that some content may be out of date.

Monday, August 6, 2018 6:35 PM

Reset Your Laravel App In Seconds

In his recent talk about Laravel Nova at Laracon US, Taylor Otwell used a nice little shortcut to reset his demo app during the presentation.

Laravel
Reset Your Laravel App In Seconds

In his recent talk about Laravel Nova at Laracon US, Taylor Otwell used a nice little shortcut to reset his demo app during the presentation. To reset an app in our local environment, we need to do three things:

  1. Drop the database.
  2. Migrate the database.
  3. Seed the database.

As of Laravel 5.5, we've been able to to use the following command to perform all three actions at once:

php artisan migrate:fresh --seed

That's still quite a lot to type if you are using this command over and over, so let's add a quick alias to our bashrc or zshrc:

alias mfs="php artisan migrate:fresh --seed"

Now you can simply type mfs to quickly refresh your application and reseed it with fresh data.

While I've got your attention, Taylor's talk is well worth watching. I always learn something new from his presentations. I love the way that he can abstract a concept to the point where thousands of developers can use it in their own projects.

Thank you for reading this article.
I hope you learned something useful.
If you've made it this far, you might like to follow me on Twitter where I post similar content and connect with like-minded people.
Follow me on Twitter
Laravel
Different Ways To Pass Data To A Laravel View
Different Ways To Pass Data To A Laravel View

Laravel views allow you to pass data to a view in a number of different ways. In this article, I'll go over four methods and describe the pros and cons for each one.

Read this article
Tips
Better Http Status Codes In Laravel
Better Http Status Codes In Laravel

This Laravel quick tip will show you how to make your code more readable and expressive by replacing http status code magic numbers with calls to static constants.

Read this article
Privacy Policy
Copyright © 2023 Carl Cassar. All Rights Reserved.