create mission tables with factory and seeder
This commit is contained in:
@@ -5,6 +5,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;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class RoadObserved extends Model
|
||||
@@ -124,4 +125,14 @@ class RoadObserved extends Model
|
||||
: Storage::disk('public')->url($value))
|
||||
);
|
||||
}
|
||||
|
||||
public function missions(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Mission::class,
|
||||
'missionable',
|
||||
'missionables',
|
||||
'missionable_id',
|
||||
'mission_id',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user