attributes['file_url'])) { $up_file = $this->attributes['file_url']; } else { $up_file = null; } return $up_file; } public function getUrlAttribute() { $url = null; if (!preg_match('/^files\//', $this->attributes['file_url'])) { $url = $this->attributes['file_url']; } return $url; } public function show_category() { return $this->belongsTo(HrtoolsCategory::class, 'type_id'); } }