Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override vanilo controllers #51

Open
samo9789 opened this issue Jul 9, 2019 · 2 comments
Open

Override vanilo controllers #51

samo9789 opened this issue Jul 9, 2019 · 2 comments

Comments

@samo9789
Copy link

samo9789 commented Jul 9, 2019

I’m using vanilo in a project I’m working on even though I realise you do not have the 1.0 yet.

I’ve had to modify a method in a controller in vendor/vanilo/framework/resources/views and I was wondering if you envisioned a system to override some of these controllers in the framework properly ?
SO I could have modified views in my main folder and leave everything untouched in vendor.

Thanks again for your help and this cool project

@samo9789 samo9789 mentioned this issue Jul 11, 2019
@fulopattila122
Copy link
Member

There were plans on idiomatic controller override, but haven't been implemented (yet) due to the lack of interest (so far) :)

What you can do is to override the route in your project and use your controller for that specific action. As a reference, you can copy the existing methods from the vendor folder.

Does this work for you for the time being?

@samo9789
Copy link
Author

Hi

Thanks for your answer, yes it will do the trick for now .

To help others, I did

php artisan route:list to see the entry for the OderController in the admin.

I added this entry in my web.php

// Admin overrides
Route::get('admin/order/{order}', 'OrderController@show')->Name('vanilo.order.show');

And I create an OrderController in app

namespace App\Http\Controllers;
use Vanilo\Framework\Http\Controllers\OrderController as VaniloOrderController;
class OrderController extends VaniloOrderController {
    public function show(Order $order)
    }
}

And I copied only the show method which I needed to change and everything else still falls back to the code in vendor/vanilo...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants