You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
596 B

1 month ago
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\Storage;
class ApplicationFile extends Model
{
protected $fillable = [
'application_id',
'kind',
'disk',
'path',
'original_name',
'size',
'mime',
];
public function application(): BelongsTo
{
return $this->belongsTo(Application::class);
}
public function publicUrl(): string
{
return Storage::disk($this->disk)->url($this->path);
}
}