create api for register road observation

This commit is contained in:
2025-02-25 11:03:13 +03:30
parent e527cc5f43
commit 21c1e0c580
7 changed files with 192 additions and 6 deletions

View File

@@ -2,8 +2,10 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
class RoadObserved extends Model
{
@@ -99,4 +101,18 @@ class RoadObserved extends Model
{
return $this->belongsTo('App\Models\EdarateShahri', 'edarate_shahri_id');
}
protected function imageAfter(): Attribute
{
return Attribute::make(
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
);
}
protected function imageBefore(): Attribute
{
return Attribute::make(
get: fn($value) => $value == null ? null : Storage::disk('public')->url($value)
);
}
}