- Add status checker + admin secure packages + upgrade enum + add sentry + upgrade to sitemap generator + bump to CRMV2 - Set customer role enum and user role enum - Update customer migration to set roles - phpcbf - faker local to fr - update lang - composer update - bump laravel ui - Redo all user crud - npm bump - Create admin command - rearrange views - redo all auth system - redo customer pro bo
37 lines
758 B
PHP
37 lines
758 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BusinessSector extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'order',
|
|
'parent_id',
|
|
];
|
|
|
|
public function employees()
|
|
{
|
|
return $this->belongsToMany(Employees::class, 'sectors_employees', 'business_sector_id', 'employee_id')->orderBy('order', 'ASC');
|
|
}
|
|
|
|
public function parent()
|
|
{
|
|
return $this->hasOne(self::class, 'id', 'parent_id');
|
|
}
|
|
|
|
public function children()
|
|
{
|
|
return $this->hasMany(self::class, 'parent_id', 'id');
|
|
}
|
|
}
|