I've a Custom function in App\Helpers.php. When I use the function in if statement in a blade file. I see error in Laragon error logs.
PHP Fatal error: Cannot redeclare CheckInvalidPlan() (previously declared in C:\laragon\www\projectname\app\Helpers.php:6) in C:\laragon\www\projectname\app\Helpers.php on line 6
However things works as expected. But why is this error causing and how can I fix it?
#Update
This is my function in Helpers.php
function CheckInvalidPlan($id)
{
if (Plan::find($id) == null)
{
return true;
}
}
This is my if statement in Controller.
if (CheckInvalidPlan ($request->plan_id))
{
return back()->with('invalid', 'Invalid membership plan spesified.');
}