/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(BlogRequest $request, $id) { // $blog = Blog::findOrFail($id); $blog->update($request->all()); return redirect('blogsAdmin'); }
public function addPhoto($id, Request $request) { if (\Auth::guest()) { return redirect('/'); } $file = $request->file('file'); $name = time() . $file->getClientOriginalName(); $file->move('blog/photos', $name); $blog = Blog::findOrFail($id); $blog->photos()->create(['path' => 'blog/photos/' . $name . '']); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $blog = Blog::findOrFail($id); return view('blog.show')->with('blog', $blog); }
public function delete($id) { $blog = Blog::findOrFail($id); return $blog->delete($id); }
public function deleteBlog($id) { $blog = Blog::findOrFail($id); return $id; //return view('administration.blog.showBlog')->with('blog', $blog); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $blog = Blog::findOrFail($id); $blog->delete(); return redirect()->route('blogs.index')->with('message', 'Item deleted successfully.'); }
public function show($id) { $blog = Blog::findOrFail($id); $author = User::findOrFail($blog->created_by); return view('blog.single', compact('blog'))->with(['author' => $author]); }
public static function blog($type, $data) { if ($type == 'id') { return Blog::findOrFail($data); } return Blog::where($type, $data)->first(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $blog = Blog::findOrFail($id); BlogTag::where('blog_id', $blog->id)->delete(); $blog->delete(); return redirect()->route('blog_index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $blog = Blog::findOrFail($id); $blog->delete(); Session::flash('flash_message', 'Blog successfully deleted!'); return redirect()->route('blogs.index'); }
public function getEdit($id) { $Blog = Blog::findOrFail($id); return view('admin.blog.edit', ['Blog' => $Blog]); }