/**
  * Usuniecie komentarza z mikrobloga
  *
  * @param int $id
  */
 public function delete($id)
 {
     $microblog = $this->microblog->findOrFail($id, ['id', 'user_id']);
     $this->authorize('delete', $microblog);
     \DB::transaction(function () use($microblog) {
         $microblog->delete();
         $parent = $this->microblog->find($microblog->parent_id);
         $object = (new Stream_Comment())->map($microblog);
         $target = (new Stream_Microblog())->map($parent);
         $delete = new Stream_Delete(new Stream_Actor(auth()->user()), $object, $target);
         (new Stream_Activity($this->stream))->add($delete);
     });
 }
 /**
  * @param $id
  * @param Microblog $repository
  * @return $this
  */
 public function index($id, Microblog $repository)
 {
     $microblog = $repository->findOrFail($id);
     $excerpt = excerpt($microblog->text);
     $this->breadcrumb->push('Mikroblog', route('microblog.home'));
     $this->breadcrumb->push($excerpt, route('microblog.view', [$microblog->id]));
     $microblog->text = app()->make('Parser\\Microblog')->parse($microblog->text);
     $parser = app()->make('Parser\\Comment');
     foreach ($microblog->comments as &$comment) {
         $comment->text = $parser->parse($comment->text);
     }
     return parent::view('microblog.view')->with(['microblog' => $microblog, 'excerpt' => $excerpt]);
 }
 /**
  * Usuniecie wpisu z mikrobloga
  *
  * @param $id
  */
 public function delete($id)
 {
     $microblog = $this->microblog->findOrFail($id, ['id', 'user_id']);
     $this->authorize('delete', $microblog);
     \DB::transaction(function () use($microblog) {
         $microblog->delete();
         // cofniecie pkt reputacji
         (new Reputation_Create($this->reputation))->undo($microblog->id);
         // put this to activity stream
         $delete = new Stream_Delete(new Stream_Actor(auth()->user()), (new Stream_Microblog())->map($microblog));
         (new Stream_Activity($this->stream))->add($delete);
     });
 }