a9000d453e
- Created Company model and migration with fields: name, tax_id, address, phone, email, website, type, notes - Created company_project pivot table with role_in_project field - Added relationships: Project.companies() and Company.projects() - Created Livewire component ProjectCompanies for managing company assignments - Added 'Companies' tab to project edit interface alongside Phases and Users tabs - Implemented assign/remove company functionality with role selection - Applied same permissions logic as user assignment (assign users permission or Admin role)
33 lines
620 B
PHP
33 lines
620 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Company extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'tax_id',
|
|
'address',
|
|
'phone',
|
|
'email',
|
|
'website',
|
|
'type',
|
|
'notes',
|
|
];
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
// Relationships
|
|
public function projects()
|
|
{
|
|
return $this->belongsToMany(Project::class, 'company_project')
|
|
->withPivot('role_in_project')
|
|
->withTimestamps();
|
|
}
|
|
}
|