I have a couple of functions which i use in all controllers like this:
//ajax
public function region()
{
return Region::all();
}
//ajax
public function provinces(Request $request)
{
if(!empty($request->input('region_select')))
{
$id_region = $request->input('region_select');
return Region::find($id_region)->Provinces;
}
else{
return Province::all();
}
}
Is it correct to extend the base controller with these functions to have them available globally? Or is there a safer and more elegant approach?
Thanks in advance.