vendredi 2 mars 2018

Cannot use routes('name') function in view outside of default routes/web.php

I have a group that uses WEB middleware (like default), but has its own routes/org.php file;

From RouteServiceProvider.php:

protected function mapWebRoutes()
{

    // Match my own domain FIRST
    Route::group(['domain' => 'a.example','www.a.example', 'admin.a.example'], function()
    {
        // Original Web Route
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    });



    // Match any other domains or subdomains
    Route::group(['domain' => '{domain}'], function()
    {
        // Org middleware
        Route::middleware('web')
            ->namespace($this->namespace)
            ->group(base_path('routes/org.php'));
    });

}

```

in routes/org.php i have Route::get('/test', 'OrgTestCtrlr@test')->name('test');

For info:

OrgTestCtrlr extends OrgBaseCtrlr

.. OrgBaseCtrlr extends Controller (default laravel controller)

(So basically OrgTest extends OrgBase extending Controller)

My function for public function test() { return view('org.test'); }

calls a blade file in ../views/org/test.blade.php

in this file i try to have a reference

I get this error

"Missing required parameters for [Route: test] [URI: test]."

*I have moved Namespaces around, tried not to extend controller so many times, etc, and i am just chasing my tail. Please advise.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire