Files
keystone/app/Models/Organisation.php
2025-03-27 12:25:27 +00:00

33 lines
766 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Organisation extends Model
{
protected $guarded = [];
public function owner(): BelongsTo
{
return $this->belongsTo(User::class, 'owner_id');
}
public function members(): BelongsToMany
{
return $this->belongsToMany(User::class)
->withPivot('role')
->as('membership')
->using(OrganisationUser::class)
->withTimestamps();
}
public function applications(): HasMany
{
return $this->hasMany(Application::class);
}
}