Support the ongoing development of Laravel.io →
Requests Input IOC
Last updated 1 year ago.
0

Anybody?

Last updated 1 year ago.
0

Nothing? :(

Last updated 1 year ago.
0
Route::get('/view/{id}', function ($id) {
    ...
});
Route::get('/post/{post_id}/comment/{comment_id}', function ($post_id, $comment_id) {
    ... 
});

http://laravel.com/docs/4.2/routing#route-parameters

Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

You could explode the string on '/' and parse through it while putting the values you want into an associative array.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

mcamara mcamara Joined 2 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.