本文整理汇总了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!']);
}
}
示例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.');
}
示例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;
}
}
示例4: destroy
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
Post::destroy($id);
return response()->json(array('success' => true));
}
示例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');
}
}
示例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']);
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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';
}
示例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));
}
示例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.');
}
示例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');
}
示例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', '文章刪除完成');
}