mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
85 lines
1.9 KiB
PHP
85 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Registration;
|
|
use App\Models\User;
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
|
|
class RegistrationPolicy extends BasePolicy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
/**
|
|
* Determine whether the user can view any models.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can view the model.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function view(User $user, Registration $registration): bool
|
|
{
|
|
return $registration->whereHas('event.course.lecturer',
|
|
fn ($q) => $q->where('team_id', $user->current_team_id))
|
|
->exists();
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can create models.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function create(User $user): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can update the model.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function update(User $user, Registration $registration): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can delete the model.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function delete(User $user, Registration $registration): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can restore the model.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function restore(User $user, Registration $registration): bool
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Determine whether the user can permanently delete the model.
|
|
*
|
|
* @return \Illuminate\Auth\Access\Response|bool
|
|
*/
|
|
public function forceDelete(User $user, Registration $registration): bool
|
|
{
|
|
//
|
|
}
|
|
}
|