*/ protected $fillable = [ 'user_id', 'title', 'description', 'category', 'target_id', 'target_type', 'is_read', 'is_admin', 'status', ]; public function getUrlAttribute() { $url = ''; if (strtolower($this->category) == 'service chat') { $url = route('cms.chat'); $chat = ServiceChat::find($this->target_id); if ($chat) { $url = $url . '?user_id=' . $chat->user_id . '&company_id=' . $chat->company_id . '&chat_id=' . $this->target_id; } } else if (strtolower($this->category) == 'bookkeeping queue') { $url = route('cms.bookkeepings'); } return $url; } public function getCategoryUrlAttribute() { $url = ''; if (strtolower($this->category) == 'service chat') { $url = route('cms.chat'); } else if (strtolower($this->category) == 'bookkeeping queue') { $url = route('cms.bookkeepings'); } return $url; } public function getImageUrlAttribute() { $url = ''; if (strtolower($this->category) == 'service chat') { $url = asset('themes/tailwind/images/building.svg'); } else if (strtolower($this->category) == 'bookkeeping queue') { $ext = pathinfo($this->description, PATHINFO_EXTENSION); $url = $ext == 'pdf' ? asset('themes/tailwind/images/pdf.svg') : asset('themes/tailwind/images/jpg.svg'); } return $url; } }