sehmbimanvir
6 months ago

Laravel Router Macro

Posted 6 months ago by sehmbimanvir

Hi,

I am facing a problem while making a call to Router Macro.

I registered the Router Macro in RouteServiceProvider.php File under the boot method in following way

    Route::macro('test', function ($prefix = '/') {
            Route::group(['prefix' => $prefix], function () {
                $this->get('/login', function () {
                    return 0;
                });
            });
        });

Now, in my web.php i am using following code to call above macro

Route::test();

But i got follwing error.

alt text

What's wrong with above code. Anyone please help.

Please sign in or create an account to participate in this conversation.