Create application

I have a short shell script in my Projects folder that I run to create fresh Laravel apps (link to gist) ⭐

So run the script like:

$ ./create_laravel_app.sh laravel-vue-tasks
$ cd laravel-vue-tasks

Database stuff 📊

We have a Laravel app and we need to store our tasks in the database.

This one artisan command creates themodel, a migration file and a resource controller.

$ php artisan make:model Task -mr

In the model file we need to tell Laravel that the attributes of the database are “mass assignable”. To do this and turn off some of Laravel’s security by default functionality we set $guarded to an empty array like so:

To check out the routes available to your application in Laravel you can always run: php artisan route:list

Head to app/Http/Controllers/TaskController.php and define our routes. It’s worth noting that we are using route model binding so a lot of the heavy lifting is defined for us. In this instance Laravel takes advantage of convention over configuration.