Skip to content

Adding a new controller

Savage edited this page Jan 30, 2017 · 4 revisions

Add a new controller to the base controller directory:

Inside your project folder, run:

$ php forge make:controller ExampleController

To create a controller inside of a sub-directory within the controller directory, you can specify the location:

Inside your project folder, run:

$ php forge make:controller Path\To\Directory\ExampleController

This will create the folder and update the namespace.

This will create a new controller like this:

<?php
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

class ExampleController extends Controller
{
    //
}