Laravel New Project Steps

Here are my steps for creating a new laravel project. I know the docs are excellent but these are the steps specific to my setup, which is probably pretty common. For reference, I use the laravel installer to create new projects and I use Homestead. I already have Homestead set up so it’s just a matter… Continue reading Laravel New Project Steps

Installing the Html and Form Builder package back into Laravel 5

Here’s how to get the Form and Html Builder package back when using Laravel 5. composer require illuminate/html Then, in /config/app.php add the following to the providers and aliases arrays: ‘providers’ => [ … ‘Illuminate\Html\HtmlServiceProvider’, ], ‘aliases’ => [ … ‘Form’=> ‘Illuminate\Html\FormFacade’, ‘HTML’=> ‘Illuminate\Html\HtmlFacade’, ],  

Disable Registration in Laravel 5

A new Laravel 5 installation comes with user registration out of the box. If you don’t want to use this feature, here is a clean way to disable it. Open up app\Http\Controllers\Auth\AuthController.php and add the following methods: public function getRegister() { return redirect(‘auth/login’); // Or wherever } public function postRegister() { } These will override… Continue reading Disable Registration in Laravel 5

Using Laravel 5 Auth Middleware

To restrict pages in your app to authentication status, add the middleware to the controller’s constructor. To restrict a page to guests only (not signed in): public function __construct() { $this->middleware(‘guest’); } For signed in users: public function __construct() { $this->middleware(‘auth’); } If you want to make exceptions for certain methods, just pass those parameters… Continue reading Using Laravel 5 Auth Middleware

Laravel Project Setup

First, get composer if you don’t already have it (Windows): https://getcomposer.org/Composer-Setup.exe I like to use the composer installer (as opposed to the Laravel Installer). Open command prompt and move into www directory (or wherever you want your project to live). composer create-project laravel/laravel name-of-project   This will create the directory “name-of-project” and place all the laravel… Continue reading Laravel Project Setup