/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $sheet = Sheet::with('lines')->find($id); if (!$sheet) { Session::flash('errorMessage', 'This sheet does not exist for editing.'); return Redirect::route('sheets.index'); } if (Auth::user()->id != $sheet->user_id) { Session::flash('errorMessage', 'You are not authorized to edit this sheet.'); return Redirect::action('SheetsController@index'); } $clueLines = Line::with('sheet')->where('sheet_id', '=', $id)->lists('clue'); $responseLines = Line::with('sheet')->where('sheet_id', '=', $id)->lists('response'); $data = array('sheet' => $sheet, 'clueLines' => $clueLines, 'responseLines' => $responseLines); return View::make('sheets.edit')->with($data); }
public function showSheets() { $sheets = Sheet::with('lines')->where('public_or_private', '=', 'public')->orderBy('id', 'desc')->paginate(10); return View::make('feed.sheets')->with('sheets', $sheets); }