amitshrestha221
2 years ago

Understanding about Helper.

Posted 2 years ago by amitshrestha221

Suppose I call a helper method from a view file.

view :


@php $xyz =  Helper::getXYZ(); @endphp


In my helper file I have this method where I perform database queries:

helper:


public static function getXYZ(){
    $xyz = XYZ::all():
    return $xyz;
}


I would like to know if this breaking the flow of MVC pattern? Because we are running DB queries directly from helper method used in view file.

Please sign in or create an account to participate in this conversation.