A box can ship with predefined controllers, and they can be used directly or via routes.

Using Custom Action

NOTE: This is nothing Concord specific, Laravel provides these possibilities out of the box.

In case an app wants to extend a boxes controller AND wants to use the boxes built in routes, it should do the following thing:

  1. Locate the route (preferably via it's name),
  2. Set your own controller/action.

You can put this code either in your app's RouteServiceProvider or the AppServiceProvider (or any service provider you prefer).


namespace App\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
    // [...]

    public function boot()

        $route = Route::getRoutes()->getByName('vanilo.order.index');

        $routeAction = array_merge($route->getAction(), [
            'uses'       => '\App\Http\Controllers\Admin\[email protected]',
            'controller' => '\App\Http\Controllers\Admin\[email protected]',

        $route->controller = false;

    // [...]

The Custom Controller:

namespace App\Http\Controllers\Admin;

class OrderController extends \Vanilo\Framework\Http\Controllers\OrderController
    public function index()
        // Custom code
        flash('Cogito ergo sum.');

        // Invoke the original action - if you want
        return parent::index();

Next: Commands »