/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($slug) { $data = post::findBySlugorfail($slug); if (Gate::denies('update', $data)) { Session::flash('success', 'No eres el creador!'); return Redirect('/home'); } else { $tags = tag::OrderBy('id', 'ASC')->lists('name', 'id'); $mytags = $data->tags->lists('id')->toArray(); return view('post.edit', compact('data', 'tags', 'mytags')); } }