cms/app/Http/Controllers/Admin/Posts/PostStoreController.php
Funky Waddle 37ed997989 feat(cms): initialize Laravel project structure and core CMS files
- Added standard Laravel directory structure and configuration.

- Included Svelte and Tailwind configuration for the admin interface.

- Added core PHPUnit and testing scripts.
2026-04-13 12:48:06 -05:00

32 lines
997 B
PHP

<?php
namespace App\Http\Controllers\Admin\Posts;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Posts\StorePostRequest;
use App\Models\CustomPostType;
use App\Services\PostService;
use Illuminate\Http\RedirectResponse;
/**
* Controller for storing a new post.
*/
class PostStoreController extends Controller
{
/**
* Store a newly created post.
*
* @param \App\Http\Requests\Admin\Posts\StorePostRequest $request
* @param \App\Models\CustomPostType $customPostType
* @param \App\Services\PostService $service
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(StorePostRequest $request, CustomPostType $customPostType, PostService $service): RedirectResponse
{
$service->storePost($customPostType, $request->validated());
return redirect()->route('admin.posts.index', $customPostType->slug)
->with('success', $customPostType->singular_name . ' created successfully.');
}
}