<?php

namespace App\Models;

use GuzzleHttp\Client;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use \App\Models\traits\SetConnection;

class RelationLeasePhoto extends Model
{
    use SetConnection;

    protected $fillable = [
        'lease_id', 'photo_url', 'order', 'file_type'
    ];
    protected static function boot()
    {
        parent::boot();
    }

    const CREATED_AT = null;
    const UPDATED_AT = null;

    public function lease()
    {
        return $this->belongsTo(Lease::class, "lease_id", "id");
    }
    public function getStorageLinkAttribute()
    {
        return str_replace('public', '/storage', $this->attributes["photo_url"]);
    }
}
