<?php

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Pencarian extends Model
{
    use HasFactory;

    public function getFileBerkasAttribute()
    {
        return storage_path($this->file['path'].'/'.$this->file['nama']);
    }

    public function getFileNamaAttribute()
    {
        return $this->file['nama'] ?? '';
    }

    public function getFilePathAttribute()
    {
        return $this->file['path'] ?? '';
    }

    // public function getUrlBerkasAttribute()
    // {
    //     return asset('formal/'.$this->file_path .'/'.$this->id.'/'. $this->file_nama);
    // }
   
    public function getUrlBerkasAttribute()
    {
        return asset('formal/download/'.$this->id.'/'. ($this->file_nama));
        //return asset($this->file_path .'/'. $this->file_nama);
    }

}
