0
Я пытаюсь применить политику на TeamController:Laravel Политика никогда не называла
TeamPolicy является:
public function before(User $user, $ability)
{
if ($user->isSuperAdmin()) {
return true;
}
return null;
}
public function create(User $user, Tournament $tournament)
{
return $user->isOwner($tournament);
}
В моем контроллере я называю это так:
public function create(Tournament $tournament)
{
$team = new Team;
if (Auth::user()->cannot('create', $team)) {
throw new UnauthorizedException();
}
}
I dd внутри обеих функций, но никогда не вызываются.
Любая идея, что не так ???
Я полностью забыл! Tx! –