I developed an API to show a pop up message when the page loaded.
Not all the pages use the pop up API. For example, if the user go to the show($id)
pag
A simple redirect using helper functions.
So you don't need to set use Redirect
nor use Session
in your Controller.
After you're done processing something in your Controller, insert:
return redirect()->route( 'clients.show' )->with( [ 'id' => $id ] );
To retrieve the variable 'id'
in route 'clients.show'
, use:
// in PHP
$id = session()->get( 'id' );
// in Blade
{{ session()->get( 'id' ) }}
Yes you can define path in route like below:
Route::get('store/{id?}/{param1?}/{param2?}/{param3?}', 'clients@store');
You can pass multiple parameter in function and read in controller by passing argument..
You can define in controller :
public function store(id, param1,param2,param3){
//read the param values
}
In store()
return Redirect::route('clients.show, $id')->with( ['data' => $data] );
and in show()
read it with
Session::get('data');