lundi 29 août 2016

how to redirect different pages in Laravel 5.2

I need redirect user pages according to status of the user. I wrote a method in My Controller in Laravel 5.2 status 1 is working but when I add else and else if function it generate following errror.

FatalErrorException in ProjectCollaboratorsController.php line 219: syntax error, unexpected 'return' (T_RETURN)

My controller method is folllowing

public function show($id){
 if (Permission::where('status', 1)->where('project_id', $id)->exists()){

    $project = Project::find($id);
    $tasks = $this->getTasks($id);
    $files = $this->getFiles($id);
    $comments = $this->getComments($id);
    $collaborators = $this->getCollaborators($id);
    $permissions = $this->getPermissions($id);



    return view('collaborators.show');
    }
else{

    (Permission::where('status', 2)->where('project_id', $id)->exists()) 
         return view('collaborators.manager');

}

else if {

(Permission::where('status', 3)->where('project_id', $id)->exists()) 
         return view('collaborators.user');
}
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire