A right kerfuffle

A blog about web development, programming and the awesomeness of the Internets

Month: September 2017

The only safe email is text-only email

Modern email clients try to safeguard us from malicious code injected in HTML emails. They might help by flagging suspicious looking senders, or hiding embedded images. But getting junk email is like being forced to visit some weird Russian site offering BitCoins. How many of us still maintain “oh but we don’t visit shady sites so there’s no real risk”? And yet, when someone with malicious intent can send this to us directly, we expect the amazingly dated browser in what, Outlook to keep us safe?

Read “The only safe email is text-only email”

Laravel routes in different files

When starting a new Laravel 5 project, all “web” routes reside in the routes/web.php. Adding a bunch of routes, maybe using Route::group for different controllers, quickly adds up and makes it hard to keep things neatly organized. Lucky for us it is very simple to add your own route files!

First create a new route file in routes folder. I’m gonna call mine admin.php and move all my admin area controllers to this file.

Open your app/Providers/RouteServiceProvider.php and find your method map():

public function map()


    // Add your own method here:

And for your mapAdminRoutes() method you simply register a new route file. In my case I’m gonna use /admin as a prefix for my admin controllers, and control access through a special middleware:

protected function mapAdminRoutes()
        ->middleware(['web', 'authAdmin:admin_access'])

There you go! Now my new route file can be stripped from its Route::group, and routes/web.php is kept to only public controllers.

Powered by WordPress & Theme by Anders Norén