I created an array in User model and a function which return this array. Laravel return Undefined variable error. Model code:
private $groups = [
'033-philosophy' => "phil",
'035.01-lit' => "lit",
'035.01-lang' => "lang",
'034' => "culture"
];
public static function getGroupsList() {
return $groups;
}
Call function in controller:
$groups = \App\User::getGroupsList();
return view('orders.create', compact('groups'));