/** * Display the specified resource. * * @return \Illuminate\Http\Response */ public function show($id) { $doc = SiteDoc::findorFail($id); // Check authorisation and throw 404 if not if (!Auth::user()->allowedTo('edit', 'site.doc', $doc)) { return view('errors/404'); } $site_id = $doc->site_id; if ($doc->type == 'RISK') { $type = 'risk'; } if ($doc->type == 'HAZ') { $type = 'hazard'; } if ($doc->type == 'PLAN') { $type = 'plan'; } return view('site/doc/edit', compact('doc', 'site_id', 'type')); }