laravel controller function parameters



PHP Snippet 1:

public function my_function(Request $request)
{   
    $songs = Song::orderBy($request->query('clef'))->get();
    return View::make('my_view', compact('songs'));
}

PHP Snippet 2:

URL::action('PostsController@show', ['100'])

PHP Snippet 3:

URL::action('PostsController@show', ['100', '10'])

PHP Snippet 4:

public function show($param1 = false, $param2 = false)
{   
    $returnData = Post::where(['column1' => $param1, 'column2' => $param2 ])->get();
    return View::make('posts.show', compact('returnData'));
}

PHP Snippet 5:

<a href="{{ action('PostsController@show', ['100', '10']) }}">Read More</a>

PHP Snippet 6:

Route::get('/post/{param1}/attachment/{param2}', [ 'as' => 'show', 'uses' => 'PostsController@show' ] );