Laravel 5.1 “intermediate quickstart” notes

I just ran through Laravel’s intermediate quickstart tutorial. On the whole it was rather well put together and worked with as little or as much copying and pasting as you felt like using. Here I’m just recording a few notes for future reference about non-obvious things I encountered.

Error messages for simple typos

One interesting thing to note is that using curly braces instead of round brackets in your blade templates can lead to not-obviously-related error messages. For instance, my first attempt at a template began with

instead of the correct

While obviously this is a simple typo that is entirely my own fault, the resulting error message,

FatalErrorException in fba8cddd62bd85dee11955629f018a61 line 24:
syntax error, unexpected ‘,’

was not particularly enlightening, and I spent rather longer than I would have liked before noticing my error.

Importing models and policies for authorisation

The tutorial seems to leave out two important lines when it comes to authorising the deletion of tasks via policy. Specifically, when the tutorial gets to the point of adding the new policy to app/Providers/AuthServiceProvider.php ,

it fails to mention that this won’t work until the lines

are also added to the file.

Redirecting on login

Finally, if you create your own files from scratch for the tutorial instead of cloning their repo, then registering and logging in will appear to result in an error,

NotFoundHttpException in RouteCollection.php line 161:

This can be surprising at first, and might make you think there actually is an error in your code, but of course it is essentially just a 404 Not Found error—by default you are redirected to /home , which hasn’t been created. One option would of course be to create home view. Another, which is what the Laravel repo does, is to override the redirection destination in app/Http/Controllers/Auth/AuthController.php  and point it at  /tasks instead.

To do so, simply set the  $redirectTo property to the desired path, for example