Route::get('/view/{id}', function ($id) {
...
});
Route::get('/post/{post_id}/comment/{comment_id}', function ($post_id, $comment_id) {
...
});
Thanks @torosegon, but that's not what I want :(
Having the url as a string, I want to know the attributes on int. As I said in the first message:
The function extractParameters('http://example.com/post/10/comments/23') must return an array like this: [ 'post_id' => 10 , 'comment_id' => 23 ]. The url 'http://example.com/post/10/comments/23'
is just a string, not the current call.
Let's see if someone can help me.
You could explode the string on '/' and parse through it while putting the values you want into an associative array.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community