App\Repositories\PostRepository::destroy PHP Метод

destroy() публичный Метод

Destroy a post.
public destroy ( $id )
$id
    public function destroy($id)
    {
        $post = $this->model->find($id);
        $post->tags()->detach();
        $post->delete();
    }

Usage Example

Пример #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $this->blog->destroy($id);
     return back()->with('ok', 'Delete post successfully.');
 }