dimanche 4 août 2019

How do I override a 'used' class?

I am using Laravel 5.8 and I'm attempting to modify a package class from the Vendor directory. To acheive this, I have created a new class which extends the Vendor class, and I can replace the named functions within it- all working great.

However, the original class 'uses' a class, which I have mimicked in my new class, as follows:

use VendorName\PackageName\OriginalController

// use VendorName\PackageName\SomeClass as StoreRequest; How can I replace this...
use App\Http\Requests\NewRequestClass as StoreRequest; // ... with this..? (not working)

class NewController extends OriginalController {

    private function somefunction(StoreRequest $request){ // This doesn't work; it is still using the StoreReqest defined in OriginalController
        // ...
    }

}

See comments- Is it possible to override this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire