add mutator for mission
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
@@ -12,6 +13,13 @@ class Mission extends Model
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function requestedMachines(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => json_decode($value)
|
||||
);
|
||||
}
|
||||
|
||||
public function roadItems(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadItemsProject::class, 'missionable');
|
||||
|
||||
Reference in New Issue
Block a user