- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
33 lines
854 B
PHP
33 lines
854 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Forms;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Form;
|
|
use App\Services\FormService;
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
/**
|
|
* Controller for deleting an existing form.
|
|
*/
|
|
class FormDestroyController extends Controller
|
|
{
|
|
/**
|
|
* Remove the specified form.
|
|
*
|
|
* @param \App\Models\Form $form
|
|
* @param \App\Services\FormService $service
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
*/
|
|
public function __invoke(Form $form, FormService $service): RedirectResponse
|
|
{
|
|
if ($service->deleteForm($form)) {
|
|
return redirect()->route('admin.forms.index')
|
|
->with('success', 'Form deleted successfully.');
|
|
}
|
|
|
|
return redirect()->route('admin.forms.index')
|
|
->with('error', 'Failed to delete form.');
|
|
}
|
|
}
|