zofe / rapyd-laravel

deprecated rewritten in rapyd-livewire
MIT License
866 stars 298 forks source link

DataFilter reset button is redirecting to wrong link #125

Open renatoxm opened 9 years ago

renatoxm commented 9 years ago

when i press reset buton, the link send's me to: http://localhost/controlexm/public/controlexm/public/admin/companies instead of going to http://localhost/controlexm/public/admin/companies.

The link is repeating the path twice.

I tried it online and the same problem happens.

Thanks in advance!

zofe commented 9 years ago

as "quick" answer I can say that rapyd url class use the laravel "link_to", so I suggest you to check your app configuration. I think your problem is missed trailing slash somewhere (probably in config/app 'url') Let me know.

farynato commented 9 years ago

I have the same problem. I obtain http://localhost/laravel5/laravel5/colonias/ratones/list when I press reset button. It should be http://localhost/laravel5/colonias/ratones/list. In my config/app I have: 'url' => 'http://localhost/laravel5/'

farynato commented 9 years ago

In my case, it works if I comment this in link method of Widget.php:

/ if (Request::path()!= $match_url) { $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY)); } /

https://github.com/zofe/rapyd-laravel/blob/master/src/Widget.php#L78

Request::path() doesn't include my prefix (laravel5) and then it doesn't match with $match_url, which includes (laravel5/colonias/ratones/list), so Persistence::get is executed. It returns the same value of $match_url (with the prefix) but after, HTML::link also include the prefix and this is the problem. If I use $url, the value passed to the method, there is no problem because it's the complete url (http://localhost/laravel5/colonias/ratones2/list), and the link is formed properly for me.

I suppose this comparison may be necessary in other cases, but maybe it's possible to improve this code a bit more in cases where the url have a prefix and you click reset.