Something like that:?
Route::get('fans/{new_column}', function($new_column){
return " hello new column $new_column";
or return View::make('fans.your_view');
});
or
Route::get('fans/{new_column}','[email protected]'):
function your_action($new_column){ do stuff here;}
...
Route::resource('fans', 'FansController');
So, the thing is that, I already have the show($id) function set up that it takes the $id, which is how I want it, because I want all of the functions I call with it to operate under that. I just want the url to appear as domain.com/fans/new_column. So not sure how:
Route::get('fans/{new_column}','FansController@show');
and the function:
public function show($id)
{
$fan = Fan::find($id);
return View::make('fans.show', compact('fan'))
->with('fans', Fan::all())
->with('latest_fan_likes', Fanartist::latest_profile_fan_likes($id));
}
will achieve what I want...
By doing this:
Route::get('fans/{new_column}','FansController@show');
or
Route::get('fans/{new_column}',['as'=>'show_a_fan', 'uses'=>'FansController@show']);
you're telling the router to find the FansController and execute the method show when the user hits http://domain.com/fans/new_column. {new_column} means the method show should receive $new_column as the parameter.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community