cd into the directory above where you want your project to live Run:
Tag: php
Symfony Doctrine Cheatsheet
Installing cd into your project directory and run composer require doctrine Open the .env file and set your local config. This uses root user and password password and sets the name of the database to the_spacebar
Symfony Cheatsheat
Here’s a bunch of random notes on Symfony. These are kind of a summary of the SymfonyCasts tutorial track here. Creating a New Controller Right-click on the directory where you want your controller to to (probably src/Controller) Choose “New PHP Class” Because we installed the Symfony plugin, PhpStorm can pre-fill the namespace
Set up Slim Framework on Docker
Here is a bunch of code-dump for setting up Slim Framework on Docker.
Seeder Class Not Found in Laravel 5
Remember whenever you create a new Seeder class, to run composer dump-autoload so the framework can find it!
Adding Soft Deletes to Existing Database Table in Laravel
First, enable soft deletes in your model. I’ll use the users table as an example.
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
Using Route Resource for RESTful routes in Laravel 5
To have laravel automatically generate all the REST routes for a controller, use Route::resource() Route::resource(‘users’, ‘UsersController’);