Answer the question
In order to leave comments, you need to log in
Is it correct to call a model method from a template?
Is it correct to call the model method (which fetches the menu from the base Menu::getMenu() ) directly from the blade template to display the menu.
@section('menu')
@include('layouts.admin.partials.menu', array('menus' => Menu::getMenu(), 'parent_id' => 0))
@show
Answer the question
In order to leave comments, you need to log in
Of course, everyone interprets MVC in their own way, however, I do not recommend doing this. If Menu::getMenu() will be called in several places, then in case of changing the data or the name of the model / method, then you will have to look for all calls in the templates. If you need to test, then there will also be problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question