Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
27 lines
653 B
PHP
27 lines
653 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Recording;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class CancelTranscriptionController extends Controller
|
|
{
|
|
/**
|
|
* Stop an in-progress or queued transcription.
|
|
*/
|
|
public function __invoke(Recording $recording): RedirectResponse
|
|
{
|
|
Gate::authorize('transcribe', $recording);
|
|
|
|
if (! $recording->isTranscribing()) {
|
|
return back()->with('error', 'No transcription is currently running.');
|
|
}
|
|
|
|
$recording->cancelTranscription();
|
|
|
|
return back()->with('success', 'Transcription stopped.');
|
|
}
|
|
}
|