34 lines
711 B
PHP
34 lines
711 B
PHP
<?php
|
|
|
|
namespace LaraBB\Post\UI\Web\Handlers;
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
use LaraBB\Post\Actions\StoreAction;
|
|
use LaraBB\Post\UI\Web\Requests\Store;
|
|
|
|
/**
|
|
* Class StoreHandler
|
|
* @package LaraBB\Post\UI\Web\Handlers
|
|
*/
|
|
class StoreHandler
|
|
{
|
|
/**
|
|
* StoreHandler constructor.
|
|
* @param StoreAction $storeAction
|
|
*/
|
|
public function __construct(private readonly StoreAction $storeAction)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param Store $request
|
|
* @return RedirectResponse
|
|
*/
|
|
public function __invoke(Store $request): RedirectResponse
|
|
{
|
|
$postId = $this->storeAction->run($request);
|
|
|
|
return $postId ? $request->success($postId) : $request->failed();
|
|
}
|
|
}
|