mardi 23 août 2016

Authentication and show data using 2 tables in laravel 5.2

I am going to view different user pages using 2 tables data. table 1 is collaborators. in this table there are 2 columns as project_id and collaborator_id showing projects data which are equal to logged user id using following mmethod

public function show($id){
    $project = Project::find($id);
    $tasks = $this->getTasks($id);
    $files = $this->getFiles($id);
    $comments = $this->getComments($id);
    $collaborators = $this->getCollaborators($id);}

and My table 2 is permissions contain following columns status,project_id,collaborator_id now I need show pages according to status of the logged user have checked project_id and collaborator_id from collaborator table as following

if(Permission::where('status', '=', '1')->first())return view('collaborators.adminshow');else (Permission::where('status', '=', '2')->first())return view('collaborators.managershow');elseif (Permission::where('status', '=', '3')->first())return view('collaborators.customershow');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire