public function assignResource($comment) { if (is_numeric($comment)) { $comment = TicketComment::findOrFail($comment); } if ($comment->link == '' || $this->id != $comment->ticket_id) { abort(404); } $this->link = $comment->link; $this->status = 'closed'; $this->save(); $this->comments()->where('selected', true)->update(['selected' => false]); $comment->selected = true; $comment->save(); }