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

Cannot use resource route #261

Open
danim80 opened this issue Jun 10, 2016 · 8 comments
Open

Cannot use resource route #261

danim80 opened this issue Jun 10, 2016 · 8 comments

Comments

@danim80
Copy link

danim80 commented Jun 10, 2016

When I try to access the 'client/1/edit' it throws NotFoundHttpException.

The route:list shows the following routes

GET|HEAD | client/create | client..create | Modules\Client\Http\Controllers\ClientController@create
GET|HEAD | client/{} | client..show | Modules\Client\Http\Controllers\ClientController@show
PUT|PATCH | client/{} | client..update | Modules\Client\Http\Controllers\ClientController@update
DELETE | client/{} | client..destroy | Modules\Client\Http\Controllers\ClientController@destroy
GET|HEAD | client/{}/edit | client..edit | Modules\Client\Http\Controllers\ClientController@edit

The route is:
Route::group(['middleware' => 'web', 'prefix' => 'client', 'namespace' => 'Modules\Client\Http\Controllers'], function()
{
Route::resource('/', 'ClientController');
});

@ghost
Copy link

ghost commented Jun 10, 2016

Please paste content of your Modules\Client\Http\routes.php file.

@danim80
Copy link
Author

danim80 commented Jun 10, 2016

Route::group(['middleware' => 'web', 'prefix' => 'client', 'namespace' => 'Modules\Client\Http\Controllers'], function()
{
Route::resource('/', 'ClientController');
});

@ghost
Copy link

ghost commented Jun 10, 2016

In default, ClientController doesn't have resource-like methods (store, edit, update etc.) - only index(). Do you created it in your controller file?

@danim80
Copy link
Author

danim80 commented Jun 10, 2016

Clients::get()]); } public function create() { return view('client::create'); } public function edit($id) { return view('client::edit'); } ``` }

@ghost
Copy link

ghost commented Jun 10, 2016

I'm checked it in my installation of laravel + modules. Works the same, but I'm found a workaround:

define your route as (i.e.):
Route::resource('/res', 'ClientController').

It generates:
client/{res}
client/{res}/edit
etc.

@danim80
Copy link
Author

danim80 commented Jun 10, 2016

Route::resource('/id', 'ClientController'); now generates

client/id
client/id
client/id/create
client/id/{id}
client/id/{id}
client/id/{id}
client/id/{id}/edit

@danim80
Copy link
Author

danim80 commented Jun 13, 2016

Other solutions?

@danim80
Copy link
Author

danim80 commented Jul 6, 2016

Nobody has this problem?

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

No branches or pull requests

1 participant