feat: add departments to projects — two-column layout with inline CRUD
This commit is contained in:
1 parent
58b3e9e0de
commit
60d57af630
6 files changed
+362
-56
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Settings;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Department extends Model
|
||||
{
|
||||
protected $table = 'settings_departments';
|
||||
|
||||
protected $fillable = ['name', 'project_id', 'is_active'];
|
||||
|
||||
protected $casts = ['is_active' => 'boolean'];
|
||||
|
||||
public function project(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ProjectSetting::class, 'project_id');
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,9 @@ class ProjectSetting extends Model
|
||||
{
|
||||
return $this->hasMany(\App\Models\Settings\Location::class, 'project_id');
|
||||
}
|
||||
|
||||
public function departments(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(\App\Models\Settings\Department::class, 'project_id');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user