chore: update document approval workflow and bug fixes
This commit is contained in:
32
Modules/MasterData/app/Models/MaterialGroup.php
Normal file
32
Modules/MasterData/app/Models/MaterialGroup.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MasterData\Models;
|
||||
|
||||
use App\Traits\HasPublicIdentifier;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Modules\ProjectManagement\Models\Project;
|
||||
|
||||
class MaterialGroup extends Model
|
||||
{
|
||||
use HasPublicIdentifier;
|
||||
|
||||
protected $fillable = ['name', 'description', 'status'];
|
||||
|
||||
public function materials(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Material::class, 'material_group_items')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function projects(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Project::class, 'project_material_groups')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('status', 'active');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user