can you help me?
if in laravel we want to get a variable in url so in route we must wrote like this:
Route::get('myweb/article/{article_id}','Controller/ArticleController@show');
it will generate like this
www.myweb.com/article/1
and in controller we can get ID with this:
public static function show(){
list($article_id) = func_get_args();
}
how about if i want url like this:
www.myweb.com/article-1 // assume 1 is article_id
how i must write line in routes.php? and how to get the ID in controller?
Did you try something like this:
Route::get('myweb/article-{article_id}','Controller/ArticleController@show');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With