This is my class
class PageController extends Controller
{
public function show($slug = null, $slug2 = null)
{
if (!$slug2) {
$cat1 = 1;
return view('frontend/pages/category', [
'categories' => $cat1
]);
}
}
}
This version of the code is working fine. If I move the return view logic into a separate function like this:
class PageController extends Controller
{
public function show($slug = null, $slug2 = null)
{
if (!$slug2) {
$cat1 = 1;
$this->myfunction($cat1);
}
}
public function myfunction($cat1)
{
return view('frontend/pages/category', [
'categories' => $cat1
]);
}
}
I'm getting a blank page. Nothing in the logs. Any idea why ?