feat: move departments from projects to companies
Departments now belong to a Company, not a Project.
- New migration: recreates settings_departments with company_id (migrates existing data)
- Department model: company_id FK, company() relation
- Company model: departments() hasMany relation
- ProjectSetting model: removes departments() relation
- Controller: dept methods now take Company instead of ProjectSetting
- Routes: department CRUD moves to companies/{company}/departments
- View: departments section appears on each company card (purple theme);
project body is now locations-only (single column)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
9a268dc79b
commit
12e07480a0
7 files changed
+206
-153
No files matched your search
@@ -8,12 +8,12 @@ class Department extends Model
|
||||
{
|
||||
protected $table = 'settings_departments';
|
||||
|
||||
protected $fillable = ['name', 'project_id', 'is_active'];
|
||||
protected $fillable = ['name', 'company_id', 'is_active'];
|
||||
|
||||
protected $casts = ['is_active' => 'boolean'];
|
||||
|
||||
public function project(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ProjectSetting::class, 'project_id');
|
||||
return $this->belongsTo(Company::class, 'company_id');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user