Recent Topics

Best way to modify RegistrationController

  • Hi. I want to implement my own registration controller. What is the best way to do that without touching the core?
    I want also to change the login controller to work according to my needs but I can not find where it is.

  • Hi, @manatech

    Basically Controller is work for a route, so if you are want any specific route should be called using your controller then create a route file in your package & used same name of route as it have in core & when this route hit, call your controllers method.


  • @shivam-webkul said in Best way to modify RegistrationController:

    if you are want any specific route should b

    Thank you but it doesn't work. Here is my route in my new package:

    Route::group(['middleware' => ['theme']], function () {
        Route::prefix('customer')->group(function () {
            Route::get('register', 'MyPackage\MyProject\Http\Controller\[email protected]')
                ->defaults('_config', [
                    'view' => 'auth::customers.signup.index'])->name('customer.register.index');

    I created the views to override the form in the appropriate location but it always shows the original form in the core when I navigate to the customer/register form. I want it to show my form instead of the original form.
    Also running the following commands didn't help:

    composer dump-autoload
    php artisan config:cache
    php artisan route:cache
    php artisan view:cache

  • Hi, @manatech

    You don't need to change the route, make same registration form as like present in customer followed by same folder structure.

    And in the boot methods write the override code and publish the vendor.

                    __DIR__ . '/../Resources/views/shop/customers/account/index' => resource_path('views/vendor/shop/customers/account/index'),

    and publish by

    php artisan vendor:publish.


Log in to reply