adrema/app/Form/Actions/IsDirtyAction.php

23 lines
457 B
PHP
Raw Normal View History

2024-04-18 22:15:28 +02:00
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class IsDirtyAction
{
use AsAction;
public function handle(Form $form, ActionRequest $request): JsonResponse
{
$form->config = $request->input('config');
return response()->json([
'result' => $form->isDirty('config'),
]);
}
}