Domanda

I'm new to laravel, actualy i just downloaded it today, and trying to work with it now. I was watching youtube videos about it, and reading documentation, but laravel documentation is not explaining anything at all...

So i'm trying now to create a new route with {$url} in it. In route.php i'm writing this:

Route::get ( "users/{$url}", "MainController@RequestData" );

and in MainController.php i'm creating a new function:

public function RequestData ( $url ) {

     return View::make("temp.rData");

}

but when i refresh a page all i get is ErrorException Undefined variable: url

i tried to define url in RequestData function, but this doesn't seem to work at all... I tried was looking for an answer for a long time, most of them are using (:any) or (:all) in case of {$url}, but none of them seems to work for me.

Can anyone help me with this ? Thank you in advance!

È stato utile?

Soluzione

define the parameter without $ and use another word as url is a facade for the url helper so this might be a reserved word in route params.

Route::get ( "users/{myurl}", "MainController@RequestData" );


public function RequestData ( $myurl ){} 

this should help you out :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top