pingpong-labs / modules

Laravel 5 Modules
https://pingpong-labs.github.io/docs/modules.html
BSD 3-Clause "New" or "Revised" License
576 stars 151 forks source link

Laravel 5 function action(controller@action) #106

Open AleksandarVucenic opened 9 years ago

AleksandarVucenic commented 9 years ago

Maybe I wrong but this function giving default namespace App\Http\Controller and if I try to call some controller form Modules folder I get default namspace or I did somthing wrong is there any way to do this correctly

gravitano commented 9 years ago

Yes, you're right. The action function always start with app namespace. That's default from Laravel 5.

AleksandarVucenic commented 9 years ago

Is there any way to change that because I didnt find that in documentation and any where else

lukepolo commented 9 years ago

heh i was just looking for the same thing , for now I just did

{{ action('\Modules\blah\Http\Controllers\blahController@index') }}

Im thinking of doing creating a PR so we don't have to do that, but if its already in the works i don't want to waste to much time on this.

kremsy commented 9 years ago

it would be really cool if you could leave the namespace there away, instead taking something like a controller namespace you set somewhere.

What I want todo: {!!URL::action('CupController@mappacks')!!}

Routes: Route::group(array('namespace' => 'App\Http\Controllers'), function () { ... Route::get('rules', 'CupController@rules'); ... });

now it always says the action is not defined as long I don't append the whole namespace.

tashpemhiwa commented 9 years ago

I would like to be able to use the action() function as follows:

<form action="{{ action('SomeController@someMethod') }}"> ...

where SomeController is a controller in my module.

Is this possible with pingpong modules or is a user forced to use the full path to the module? It would be great if it were possible to avoid the full path. @kremsy's method above looks like a nice wat to configure it.

nWidart commented 9 years ago

That's not possible, even in laravel without pingpong modules, if your controllers use namespaces.