Welcome Guest, Not a member yet? Register   Sign In
auto load header menu data to each page
#2

(This post was last modified: 07-20-2020, 06:29 AM by marcogmonteiro.)

You want to autoload this model inside your BaseController.php Then you get the data into a class property so you can access it in all your controllers that extend to BaseController.php.

Something like:


PHP Code:
$model = new ArticleModel();
$this->data['header'] = $model->yourFunction(); 


Then in your controllers you just send the data into your views.

PHP Code:
return view('foo'$this->data); 
Website: marcomonteiro.net  | Blog: blog.marcomonteiro.net | Twitter: @marcogmonteiro | TILThings: tilthings.com
Reply


Messages In This Thread
RE: auto load header menu data to each page - by marcogmonteiro - 07-20-2020, 06:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB