- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
32 lines
901 B
PHP
32 lines
901 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Pages;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Admin\Pages\StorePageRequest;
|
|
use App\Services\PageService;
|
|
|
|
/**
|
|
* Controller to handle storing a new Page.
|
|
*/
|
|
class PageStoreController extends Controller
|
|
{
|
|
/**
|
|
* Handle the incoming request.
|
|
*
|
|
* @param StorePageRequest $request The validated store request.
|
|
* @param PageService $pageService The page service instance.
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
*/
|
|
public function __invoke(StorePageRequest $request, PageService $pageService)
|
|
{
|
|
$page = $pageService->store($request->validated());
|
|
|
|
if ($page) {
|
|
return redirect()->route('admin.pages.index')->with('status', 'Page created successfully.');
|
|
}
|
|
|
|
return redirect()->back()->withInput()->with('error', 'Failed to create the page.');
|
|
}
|
|
}
|