Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 1 year ago.
0

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]n'):

function your_action($new_column){ do stuff here;}
...

Route::resource('fans', 'FansController');

Last updated 1 year ago.
0

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...

Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

msutyak msutyak Joined 7 Mar 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.