Home > OS >  Undefined constant After Clearing The Routes&config:cache In Laravel
Undefined constant After Clearing The Routes&config:cache In Laravel

Time:07-29

Hello Guys I Have a Constant In My Routes But When I Called It From My Function it showed me this error

Undefined constant "App\Http\Controllers\Admin\PAGINATION_COUNT" This Error Appering After did Cleared Routes&Config:cache

Using These Codes

php artisan config:cache

php artisan route:cache

Myconstant in The Routes:

const PAGINATION_COUNT = 10;

MyFunction

    public function  index() {
 $languages = Language::select()->paginate(PAGINATION_COUNT);
        return view('admin.languages.index' , compact('languages'));
    }

CodePudding user response:

Try These


php artisan cache:clear

php artisan route:clear

CodePudding user response:

Try this!

php artisan optimize:clear

CodePudding user response:

Cache has nothing to do here, try to not deal with it. You are missing the namespace in the controller (where the index function is) or pass the namespace on the route :

Route::group(['namespace' => 'App\Http\Controllers\Admin'], function()
{
.
.
.
  • Related