create mission tables with factory and seeder
This commit is contained in:
29
app/Models/Mission.php
Normal file
29
app/Models/Mission.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
class Mission extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function roadItems(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadItemsProject::class, 'missionable');
|
||||
}
|
||||
|
||||
public function roadPatrols(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadPatrol::class, 'missionable');
|
||||
}
|
||||
|
||||
public function roadObserveds(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadObserved::class, 'missionable');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user