30 lines
818 B
PHP
30 lines
818 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Admin\Forms;
|
||
|
|
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Http\Requests\Admin\Forms\StoreFormRequest;
|
||
|
|
use App\Services\FormService;
|
||
|
|
use Illuminate\Http\RedirectResponse;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Controller for storing a newly created form.
|
||
|
|
*/
|
||
|
|
class FormStoreController extends Controller
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Store a newly created form.
|
||
|
|
*
|
||
|
|
* @param \App\Http\Requests\Admin\Forms\StoreFormRequest $request
|
||
|
|
* @param \App\Services\FormService $service
|
||
|
|
* @return \Illuminate\Http\RedirectResponse
|
||
|
|
*/
|
||
|
|
public function __invoke(StoreFormRequest $request, FormService $service): RedirectResponse
|
||
|
|
{
|
||
|
|
$service->storeForm($request->validated());
|
||
|
|
|
||
|
|
return redirect()->route('admin.forms.index')
|
||
|
|
->with('success', 'Form created successfully.');
|
||
|
|
}
|
||
|
|
}
|