A class import is missing in Laravel Framework

Viewed 2259

I don't know why laravel can't load general.php in helpers folder ?

enter image description here

composer.json

"files":[
        "app/Helpers/General.php"
    ],

app.php

'providers' => [
 ...
  App\Providers\GeneralServiceProvider::class,
 ],

 'aliases'=> [
 ...
 'General'=> 'App\Helpers\General::class',
 ]

GeneralServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class GeneralServiceProvider extends ServiceProvider
{
/**
 * Register services.
 *
 * @return void
 */
public function register()
{
    require_once app_path() . '/Helpers/General.php';
}
1 Answers

Replace the following line in app.php,

'General' => 'App\Helpers\General::class',

To this.

'General' => App\Helpers\General::class,

See the difference?

Related