Reputation: 1142
I have a controller function that gets called and returns a redirect_url to an AJAX request.
This is created using this call:
URL::to('model/configuration/'. $data->id )
In both production and local, there is a "prefix" url before the "model/" part of the URL. For example, the final url may look like part1/part2/model/configuration/8.
On production, the "part1/part2" part is not being generated by the URL::to() call.
Any idea why this is occurring and how to fix it?
full route definitions:
Route::post('model/configuration/{order_id}', ModelController@configUpdate');
Route::get('model/configuration/{order_id}', 'ModelController@model');
Upvotes: 0
Views: 31
Reputation: 24661
You mention a 'prefix' in your question, but I didn't see any in your route definitions. Regardless, I don't think URL::to()
actually verifies that a route exists, and you can use it to make non-existent links to within your application (for whatever good that will do you).
I would suggest for you to instead name your route, and then you can leverage the URL::route()
method instead:
Route::group(['prefix' => 'test'], function() {
Route::get('test2', [ 'as' => 'testing', function() {
var_dump(URL::route('testing'));
}]);
});
This will output the following URL:
string 'http://server.com/test/test2' (length=28)
Upvotes: 1