当前位置: 首页>>代码示例>>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;未经允许,请勿转载。