mercredi 23 décembre 2015

Call to undefined function : Laravel 5.1

I have a private function as written below in the Controller.

private function GetProjects($ProjectStatus) {
    return \App\Models\Project\Project_Model
            ::where('ProjectStatusID', $ProjectStatus)
            ->where('WhoCreatedTheProject', auth()->user()->UserID)->get();
}

Below is the action method that is using this private function.

public function ClientCancelledProjects() {
    $ProjectStatus = \App\Enumeration\Project\ProjectStatus::Cancelled;         
    $MyProjects = GetProjects($ProjectStatus);
    return view("Project.Client.MyProject", array("Projects" => $MyProjects));
}

Below is the Error coming when running the controller.

Call to undefined function App\Http\Controllers\Project\GetProjects()

Somebody knows why this is happening ? I am trying to reuse some lines of code as they are written many times in the Controller.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire