21 lines
517 B
PHP
21 lines
517 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\User;
|
|
|
|
class ParentChildPolicy
|
|
{
|
|
public function attach(User $actor, User $parent, User $child): bool
|
|
{
|
|
if ($actor->hasRole('platform-admin')) return true;
|
|
return $actor->hasRole('parent') && $actor->id === $parent->id;
|
|
}
|
|
|
|
public function detach(User $actor, User $parent, User $child): bool
|
|
{
|
|
if ($actor->hasRole('platform-admin')) return true;
|
|
return $actor->hasRole('parent') && $actor->id === $parent->id;
|
|
}
|
|
}
|