skip to Main Content

I don’t know if I’m so stupid or my laravel is broken, BUT, here it is.

That’s my api.php:

Route::get('/airport', [AppHttpControllersAirportsController::class, 'index']);
Route::post('/airports', [AppHttpControllersAirportsController::class, 'create']);
Route::get('/registrator', [AppHttpControllersRegistrationController::class, 'index']);

The airport and airports work great. It’s add all data in db or get data from db.
But registartor just don’t work. It shows ERROR 404 and that’s all.

RegistrationController:

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

class RegistrationController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return IlluminateHttpResponse
     */
    public function index()
    {
        return 1;
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return IlluminateHttpResponse
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @return IlluminateHttpResponse
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function destroy($id)
    {
        //
    }
}

It’s just show ERROR 404 in anyway, not matter what request I do. I mean, I can rename airport in airportt and restart my server, but It still will show me ERROR 404, until I change airportt to airport

2

Answers


  1. All what I need to do is just clear route cache using artisan. Just enter a command in cmd:
    php artisan route:clear

    Login or Signup to reply.
  2. You could do

    php artisan optimize
    

    in your command it will clear multiple things like

    Configuration cache cleared!
    Configuration cached successfully!
    Route cache cleared!
    Routes cached successfully!
    Files cached successfully!
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search