create many to many relation between rahdaran and road item
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class RoadItemsProject extends Model
|
||||
{
|
||||
@@ -55,8 +56,6 @@ class RoadItemsProject extends Model
|
||||
'activity_date_time',
|
||||
'cmms_machine_id',
|
||||
'cmms_machine_code',
|
||||
'rahdar_id',
|
||||
'rahdar_code',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -134,8 +133,6 @@ class RoadItemsProject extends Model
|
||||
'is_new' => 1,
|
||||
'cmms_machine_id' => $attributes['cmms_machine_id'],
|
||||
'cmms_machine_code' => $attributes['cmms_machine_code'],
|
||||
'rahdar_id' => $attributes['rahdar_id'],
|
||||
'rahdar_code' => $attributes['rahdar_code'],
|
||||
]);
|
||||
|
||||
// if ($info_item->needs_image) {
|
||||
@@ -165,7 +162,7 @@ class RoadItemsProject extends Model
|
||||
]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return $road_item;
|
||||
});
|
||||
|
||||
return $road_item;
|
||||
@@ -173,4 +170,9 @@ class RoadItemsProject extends Model
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
|
||||
public function rahdaran(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Rahdaran::class,'rahdaran_road_items_project');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user