I have a problem with my API on laravel. I created a SupportController that i've added to my routes/api.php
My controller :
<?php
namespace App\Http\Controllers;
use App\Http\Requests\SupportRequest;
class SupportController extends Controller
{
public function store(SupportRequest $request) {
if($request->validate())
{
return response()->json('success', 200);
} else {
return response()->json('error', 400);
}
}
}
My routes :
Route::post('/support', [SupportController::class, 'store']);
And postman return :
{
"Laravel": "8.83.18"
}
Actually, i tryied to fix my cache using php artisan cache:clear and php artisan route:clear.
I got this message in my server console:
closed without sending a request it was probably just an unused speculative preconnection
Edit: Here is my supportRequest:
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SupportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'message' => ['required', 'min:10']
];
}
}