/**
  * 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 . '']);
 }
Example #3
0
 /**
  * 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);
 }
Example #5
0
 public function deleteBlog($id)
 {
     $blog = Blog::findOrFail($id);
     return $id;
     //return view('administration.blog.showBlog')->with('blog', $blog);
 }
Example #6
0
 /**
  * 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.');
 }
Example #7
0
 public function show($id)
 {
     $blog = Blog::findOrFail($id);
     $author = User::findOrFail($blog->created_by);
     return view('blog.single', compact('blog'))->with(['author' => $author]);
 }
Example #8
0
 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');
 }
Example #10
0
 /**
  * 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]);
 }