FAQ Database Discussion Community


Access a URL Parameter in a Route Prefix from Middleware

php,laravel,routing,laravel-5,laravel-request
I am struggling to access a route prefix parameter from my middleware. Given this URL: http://www.example.com/api/v1/campaign/40/status, and the following route: Route::group( [ 'prefix' => 'api/v1' ], function() { Route::group( [ 'prefix' => 'campaign/{campaign}', 'where' => [ 'campaign' => '[0-9]+' ], 'middleware' => [ 'inject_campaign' ] ], function() { Route::get( 'status',...

Laravel - Path of page from which request was made

laravel-5,laravel-routing,laravel-request
How can I determine the path of the page from which the request was made? I have tried $request->path() or Request::path() but these two return the path on which request is going.. ...

Request::getQueryString() without some parameters

laravel,laravel-5,laravel-routing,laravel-request
I am using the following code to append the query strings with two links. But I want to exclude the page parameter of pagination from the query string. <li><a href="/teachers?{{ Request::getQueryString()}}">Teachers</a></li> <li><a href="/courses?{{ Request::getQueryString()}}">Courses</a></li> What is the way to do it? I tried the following code but it generates error....

Laravel 5 HTTP/Requests - pass url parameter to the rules() method

laravel-routing,laravel-5,laravel-request
I'm trying to create a set of rules under the new \HTTP\Requests\UpdateArticle class for the slug field, which needs to have unique filter applied, but only when the id is not equal the url parameter of the route name article/{article}. What I got so far is: public function rules() {...