Warning: The magic method SFML_Singleton::__wakeup() must have public visibility in /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php on line 72

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/rest-api/class-wp-rest-server.php on line 1642
{"id":60,"date":"2015-12-16T01:09:17","date_gmt":"2015-12-16T08:09:17","guid":{"rendered":"http:\/\/www.munderwood.ca\/?p=60"},"modified":"2015-12-16T01:43:32","modified_gmt":"2015-12-16T08:43:32","slug":"laravel-5-1-intermediate-quickstart-notes","status":"publish","type":"post","link":"https:\/\/www.munderwood.ca\/index.php\/2015\/12\/16\/laravel-5-1-intermediate-quickstart-notes\/","title":{"rendered":"Laravel 5.1 “intermediate quickstart” notes"},"content":{"rendered":"

I just ran through Laravel’s intermediate quickstart tutorial<\/a>. 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.<\/p>\n

Error messages for simple typos<\/h1>\n

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<\/p>\n

\/\/ Incorrect way to extend a layout:\r\n\/\/ Note the use of {} instead of ()\r\n@extends{'layout.php'} \/\/ DO NOT DO THIS!\r\n<\/pre>\n

instead of the correct<\/p>\n

\/\/ Correct way to extend a template\r\n@extends('layout.app')<\/pre>\n

While obviously this is a simple typo that is entirely my own fault, the resulting error message,<\/p>\n

FatalErrorException in fba8cddd62bd85dee11955629f018a61 line 24:
\nsyntax error, unexpected ‘,’<\/p><\/blockquote>\n

was not particularly enlightening, and I spent rather longer than I would have liked before noticing my error.<\/p>\n

Importing models and policies for authorisation<\/h1>\n

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<\/span>\u00a0,<\/p>\n

protected $policies = [\r\n    Task::class => TaskPolicy::class,\r\n];<\/pre>\n

it fails to mention that this won’t work until the lines<\/p>\n

\/\/ app\/Providers\/AuthServiceProvider.php\r\n\r\n\/\/ ...\r\n\r\nuse App\\Task;\r\nuse App\\Policies\\TaskPolicy;\r\n\r\n\/\/ ...<\/pre>\n

are also added to the file.<\/p>\n

Redirecting on login<\/h1>\n

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

NotFoundHttpException in RouteCollection.php line 161:<\/p><\/blockquote>\n

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\u2014by default you are redirected to \/home<\/span>\u00a0, 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<\/span>\u00a0 and point it at\u00a0\/tasks<\/span>\u00a0instead.<\/p>\n

To do so, simply set the\u00a0$redirectTo<\/span>\u00a0property to the desired path, for example<\/p>\n

\/\/ app\/Http\/Controllers\/Auth\/AuthController.php\r\n\r\nclass AuthController extends Controller\r\n{\r\n    \/\/ ...\r\n\r\n    use AuthenticatesAndRegistersUsers, ThrottlesLogins;\r\n\r\n    protected $redirectTo = '\/tasks';\r\n\r\n    \/\/ ...\r\n}<\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

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 … [Read more…]<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[4,5],"_links":{"self":[{"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":14,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.munderwood.ca\/index.php\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}