- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
25 lines
610 B
PHP
25 lines
610 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Pages;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Page;
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Services\PageService;
|
|
|
|
class PageDestroyController extends Controller
|
|
{
|
|
/**
|
|
* Handle the incoming request.
|
|
*/
|
|
public function __invoke(Request $request, Page $page, PageService $pageService)
|
|
{
|
|
if ($pageService->delete($page)) {
|
|
return redirect()->route('admin.pages.index')->with('status', 'Page deleted successfully.');
|
|
}
|
|
|
|
return redirect()->back()->with('error', 'Failed to delete the page.');
|
|
}
|
|
}
|