/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (Post::destroy($id)) {
         return redirect('/posts')->with(['success' => 'Post deletado com sucesso!']);
     } else {
         return redirect('/posts')->with(['danger' => 'Erro ao deletar post!']);
     }
 }
Example #2
0
 public function destroy(Post $post)
 {
     if (\Request::has('id')) {
         Post::destroy(\Request::input('id'));
         return ['result' => true];
     }
     $post->delete();
     return redirect('dash/post')->with('message', 'Post was delete success.');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (Post::find($id)) {
         $post = Post::destroy($id);
         $result['message'] = 'Post successfully deleted.';
         return $result;
     }
 }
Example #4
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     Post::destroy($id);
     return response()->json(array('success' => true));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id == null) {
         return redirect()->back();
     }
     $post = null;
     $post = Post::find($id);
     if ($post) {
         Post::destroy($id);
         toast()->success("Postagem removida!", "Mensagem");
         return redirect()->back();
     } else {
         redirect()->route('profile');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $post = Post::find($id);
     if (File::exists(public_path() . '/admin/images/posts/' . $post->image)) {
         File::delete(public_path() . '/admin/images/posts/' . $post->image);
     }
     if (count($post->PostImages) > 0) {
         foreach ($post->PostImages as $img) {
             if (File::exists(public_path() . '/admin/images/posts/' . $img->name)) {
                 File::delete(public_path() . '/admin/images/posts/' . $img->name);
             }
         }
     }
     Post::destroy($id);
     return response()->json(['message' => 'Post successfully deleted']);
 }
Example #7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     Session::flash('message', 'You have successfull deleted a blog post');
     return Redirect::route('posts.index');
 }
Example #8
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     \App\Post::destroy($id);
     return redirect()->route('posts.index');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect('posts');
 }
Example #10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     Session::flash('flash_message', 'Post deleted!');
     return redirect('post');
 }
Example #11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return 'La conférence est supprimée de l\'agenda';
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $post = Post::destroy($id);
     return redirect(route('backend.index', $post));
 }
Example #13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($debate, $post)
 {
     Post::destroy((int) $post);
     return back()->with('message', 'Réponse supprimée avec succès.');
 }
Example #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect()->to('post')->with('message', 'Suppression avec succès');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Post::destroy($id);
     return redirect()->route('posts.index')->with('success', '文章刪除完成');
 }
Example #16
0
 public function destroy($id)
 {
     $post = Post::findOrFail($id);
     $post = Post::destroy($id);
 }
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect('/post')->with('alert', ['message' => 'Post excluído com sucesso', 'type' => 'success', 'before' => null, 'after' => null]);
 }
Example #18
0
 public function adminDeletePost(Request $request)
 {
     Post::destroy($request->delete);
     return back();
 }
Example #19
0
 public function delete($id)
 {
     Post::destroy($id);
     return redirect("/posts");
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect()->back();
 }
Example #21
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $posts = Post::destroy($id);
     $post = Post::all()->random();
     return redirect()->route('posts.show', $post->id);
 }
Example #22
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect()->to('admin/post')->with('message', 'success delete');
 }
Example #23
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $post = Post::destroy($id);
     return view('Admin/index');
 }
Example #24
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return 'Conférence supprimée';
 }
Example #25
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $post = Post::find($id);
     if (!Auth::check()) {
         return response()->json(['error' => 'You\'re not logged in.']);
     }
     if (Auth::user()->id === $post->user_id || Auth::user()->is_admin) {
         Post::destroy($id);
         return response()->json(['success' => true]);
     } else {
         return response()->json(['error' => "You don't have the authority to delete this post."]);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     // dd('destroy');
     //刪除
     Post::destroy($id);
     // return 'posts.destroy: ';
     return redirect()->route('posts.index');
 }
Example #27
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect()->to('dashboard')->with('success', 'success delete!');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  Post $post
  * @return \Response
  */
 public function destroy($post)
 {
     Post::destroy($post);
     return redirect()->route('blog')->with('success', trans('post.deleted'));
 }
Example #29
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
 }
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect()->route('posts.index');
     /*
             v2,ok
             $post = Post::find($id);
             $post->delete();
             v1,ok
             Post::destroy($id);*/
     /*$post = \App\Post::find($id);
             foreach($post->comments as $comment) {
                 $comment->delete();
             }
     
             $post->delete();
     
             return redirect()->route('posts.index');*/
 }