hi trying following in laravel 5.2.
summary: pass variables middleware view, via controller
detailed: when client logged in, no matter route want, need check if have completed "setup steps" (each step refers different route, e.g. 1 company info, product settings, etc). if have completed setup steps, let them proceed chosen route, otherwise redirect appropriate "setup steps" route, whichever 1 haven't completed yet.
all client controllers run same middleware, called nonsuperadmin. put checking of "setup steps" in middleware, , redirect there appropriate. if client redirected setup route middleware, need "incompletesetuptasks" collection passed on relevant view, via appropriate setup steps controller method.
is possible? appreciated.
in middleware use session handler
if($condition === true){ $data = [ //your content ]; session::flash('your_key', $data); } next($request);
this data available in controller , in view
this how can access data in controller
public function yourcontrolleraction($request) { $somevariable = session::get('your_key'); $viewdata = [ 'content' => $somevariable ] return view('yourview', $viewdata); }
or directly access session data in view
//inblade <p> html content @foreach(session::get('your_key' $data) //your stuff @endif </p>
Comments
Post a Comment