jeudi 28 juillet 2016

How to override a vendor class in Laravel 5?

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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire