Przemyslaw Wojtas
Przemyslaw Wojtas

Reputation: 391

Laravel custom facade class 'name' does not exist

In my controller I have:

use App\Facade\Social;

$twitter_id = $entity->twitter_business;

if (!empty($twitter_id)) {
    $twitter_array = Social::twitter($twitter_id, $id);
    $postCount = $postCount + count($twitter_array);
    Log::info('Twitter ok for', ['entity_id' => $id]);
}

Facade itself:

protected static function getFacadeAccessor()
{
    return 'social';
}

and service provider:

public function register()
{
    $this->app->bind('social', function ($app) {
        return new Social();
    });
}

However I get an error:

Class social does not exist

Provider and facade are both included in config/app.php so why does this error occur?

Upvotes: 1

Views: 2578

Answers (1)

Dmitriy Doronin
Dmitriy Doronin

Reputation: 778

Try to clear cache:

php artisan cache:clear

And autoload new providers:

composer dump-autoload

Upvotes: 3

Related Questions