belongsTo(Account::class); } /** * Get the contacts record associated with the photo. */ public function contacts() { return $this->belongsToMany(Contact::class)->withTimestamps(); } /** * Get the contact record associated with the photo. * * @return Contact */ public function contact() { return $this->contacts()->first(); } /** * Gets the full path of the photo. * * @return string */ public function url() { $url = $this->new_filename; return asset(Storage::disk(config('filesystems.default'))->url($url)); } }