first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Verifikator;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
class Team extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'verifikator.teams';
|
||||
|
||||
protected $fillable = ['nama', 'unit_kerja_id'];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, TeamUser::class, 'team_id', 'user_id')->withPivot('active');
|
||||
}
|
||||
|
||||
public function permissions()
|
||||
{
|
||||
return $this->belongsToMany(Permission::class, 'verifikator.team_permissions', 'team_id', 'permission_id');
|
||||
}
|
||||
|
||||
public function unitKerja()
|
||||
{
|
||||
return $this->belongsTo(UnitKerja::class, 'unit_kerja_id');
|
||||
}
|
||||
|
||||
public function teamUnitKerjas(): HasMany
|
||||
{
|
||||
return $this->hasMany(TeamUnitKerja::class, 'team_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user