3

I can't seem to get this specific class overridden.

In RouteServiceProviders boot() function I have this line:

$this->app->bind('Dingo\Api\Routing\Route', 'App\Extensions\Vendor\Dingo\Api\Routing\Route');

I'm trying to override the Dingo Route class as you can see, with my own custom class located at App\Extensions\Vendor\Dingo\Api\Routing

My custom Route class looks like this:

<?php
namespace App\Extensions\Vendor\Dingo\Api\Routing;

use Dingo\Api\Routing\Route as RouteBase;

class Route extends RouteBase
{
    /**
     * Merge the controller properties onto the route properties.
     *
     * @return void
     */
    protected function mergeControllerProperties()
    {
        echo 'huge success';
        exit;
    }
}

What am I doing wrong? It calls mergeControllerProperties() on the Dingo Route class instead of my custom class??

I can mention that it worked fine until I ran composer update a while ago.

Warz
  • 333
  • 3
  • 11
  • 1
    Which specific version of Laravel 5 are you using? Is it just 5.0, or 5.1/5.2? – syscll Jul 28 '16 at 12:34
  • I'm using Laravel 5.2 – Warz Jul 28 '16 at 12:58
  • Just to eliminate a potential problem, is your Service Provider registered? (I can't remember if RouteServiceProvider comes default with Laravel) - https://laravel.com/docs/5.2/providers#registering-providers – syscll Jul 28 '16 at 13:06
  • Yep. I am 100% sure that the boot method in RouteServiceProvider runs. – Warz Jul 28 '16 at 13:27
  • As a test, don't extend the RouteBase class in your custom class and see if it works then. – syscll Jul 28 '16 at 13:36
  • No difference, it seems the file does not even load at all. I tried adding exit; to the top of the file just after namespace declaration, it never executes. – Warz Jul 28 '16 at 15:20

0 Answers0