當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Post::destroy方法代碼示例

本文整理匯總了PHP中app\Post::destroy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Post::destroy方法的具體用法?PHP Post::destroy怎麽用?PHP Post::destroy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Post的用法示例。


在下文中一共展示了Post::destroy方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 /**
  * 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!']);
     }
 }
開發者ID:AndreFSilveira,項目名稱:minicurso-laravel,代碼行數:14,代碼來源:PostsController.php

示例2: destroy

 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.');
 }
開發者ID:Yuth-Set,項目名稱:cms,代碼行數:9,代碼來源:PostController.php

示例3: destroy

 /**
  * 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;
     }
 }
開發者ID:litemax,項目名稱:Blog-via-Laravel-v.0.0.1,代碼行數:14,代碼來源:PostController.php

示例4: destroy

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     Post::destroy($id);
     return response()->json(array('success' => true));
 }
開發者ID:j1edward1,項目名稱:phpio,代碼行數:12,代碼來源:PostController.php

示例5: destroy

 /**
  * 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');
     }
 }
開發者ID:aureliomachados,項目名稱:social,代碼行數:21,代碼來源:PostController.php

示例6: destroy

 /**
  * 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']);
 }
開發者ID:subirrastogi,項目名稱:laravel-angular-cms,代碼行數:22,代碼來源:PostController.php

示例7: destroy

 /**
  * 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');
 }
開發者ID:l3iodeez,項目名稱:bloggit,代碼行數:12,代碼來源:PostsController.php

示例8: destroy

 /**
  * 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');
 }
開發者ID:Ekbert,項目名稱:crud_local,代碼行數:11,代碼來源:PostsController.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Post::destroy($id);
     return redirect('posts');
 }
開發者ID:MENG-WEI-LUN,項目名稱:controller,代碼行數:11,代碼來源:postController.php

示例10: destroy

 /**
  * 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');
 }
開發者ID:kazuhiko-hotta,項目名稱:laos,代碼行數:13,代碼來源:PostController.php

示例11: destroy

 /**
  * 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';
 }
開發者ID:patlegris,項目名稱:ConfPHP,代碼行數:11,代碼來源:PostController.php

示例12: destroy

 /**
  * 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));
 }
開發者ID:julesnicolas,項目名稱:laravel,代碼行數:11,代碼來源:PostBackController.php

示例13: destroy

 /**
  * 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.');
 }
開發者ID:soywod,項目名稱:MAD,代碼行數:11,代碼來源:PostController.php

示例14: destroy

 /**
  * 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');
 }
開發者ID:AndryRana,項目名稱:ConfPHP,代碼行數:11,代碼來源:PostController.php

示例15: destroy

 /**
  * 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', '文章刪除完成');
 }
開發者ID:shadowduck,項目名稱:201505-nutc-workshop-example,代碼行數:11,代碼來源:PostsController.php


注:本文中的app\Post::destroy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。