Files
2025-11-27 10:57:11 +03:30

23 lines
454 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Image extends Model
{
protected $fillable = ['user_id', 'path', 'title', 'description','type',];
public function user() {
return $this->belongsTo(User::class);
}
public function getUrlAttribute()
{
return asset('storage/' . $this->path);
}
// Make sure the URL is included when serializing
protected $appends = ['url'];
}