@MasterCopipaster

Почему возникает ошибка FormController does not exist в laravel?

Laravel Framework 5.8.38
подскажите куда копать? почему то возникает ошибка

ReflectionException - Class App\Http\Controllers\Site\FormController does not exist
app/Http/Middleware/Cors.php at line 18 in Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
app/Http/Middleware/SetLocale.php at line 20 in Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
public/index.php at line 53 in Illuminate\Foundation\Http\Kernel::handle

Роутинги
Route::group(['prefix' => '/api/v1', 'namespace' => 'Site', 'middleware' => ['api','cors']], function() {
    Route::post("form/send", "FormController@send")
});

Cors.php - почему то ошибка возникает именно в этом файле
<?php

namespace App\Http\Middleware;

use Closure;

class Cors
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return $next($request)
            ->header('Access-Control-Allow-Origin', '*')
            ->header('Accept-Patch', '*')
            ->header('Allow', 'GET, POST, PUT, DELETE, OPTIONS, PATCH')
            ->header('Access-Control-Allow-Credentials', 'true')
            ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS, PATCH')
            ->header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization')
            ->header('Access-Control-Request-Headers', 'X-Requested-With, accept, content-type');
    }
}


Собственно контроллер
namespace App\Http\Controllers\Site;

use App\Http\Controllers\Controller;
use App\Models\Form;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class FormController extends Controller
{
    private $form;
    private $formFields;

    public function send(Request $request) {
        $time = time();

        $this->formFields = $request->all();
        $this->formFields["ip"] = request()->server("REMOTE_ADDR");

        $this->form = new Form($this->formFields);
        if($this->saveForm()) {
            if($this->sendEmail()) {
                return response()->json(["status" => "success"]);
            }
        }
    }
//........
  • Вопрос задан
  • 56 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы