![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/Corals/modules/Medad/Models/ |
<?php namespace Corals\Modules\Medad\Models; use Corals\Foundation\Models\BaseModel; use Corals\Modules\Medad\Traits\CanBeNotified; use Corals\Modules\Utility\Models\Address\Location; use Corals\User\Models\User; use Illuminate\Notifications\Notifiable; class CompanyModel extends BaseModel { use Notifiable, CanBeNotified; protected $formModalConfig = ['size' => 'modal-lg']; public function isCompany() { return $this->parent_id === $this->id; } protected $table = 'medad_companies'; protected $casts = [ 'properties' => 'json', ]; protected $guarded = ['id']; public function admins() { return $this->belongsToMany(User::class, 'medad_company_user', 'company_id', 'user_id') ->withTimestamps() ->withPivot(['is_admin', 'properties']) ->where('medad_company_user.is_admin', 1); } public function users() { return $this->belongsToMany(User::class, 'medad_company_user', 'company_id', 'user_id') ->withTimestamps() ->withPivot(['is_admin', 'properties']) ->where('medad_company_user.is_admin', 0); } public function location() { return $this->belongsTo(Location::class); } public function getNotifiables() { return $this->admins; } }