Files
AndyTranscribe/app/Policies/RecordingPolicy.php
T
ben bfcfc12f58 Add Fortify auth, Flux dark mode, demo seed, and Docker hot reload.
Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
2026-08-12 18:38:53 +02:00

58 lines
1.2 KiB
PHP

<?php
namespace App\Policies;
use App\Models\Recording;
use App\Models\User;
class RecordingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Recording $recording): bool
{
return $recording->user_id === $user->id;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return true;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Recording $recording): bool
{
return $recording->user_id === $user->id;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Recording $recording): bool
{
return $recording->user_id === $user->id;
}
/**
* Determine whether the user can start or stop transcription.
*/
public function transcribe(User $user, Recording $recording): bool
{
return $recording->user_id === $user->id;
}
}