使用别名时找不到Laravel 5.5外观

时间:2017-12-16 20:02:40

标签: php mysql laravel vimeo laravel-5.5

我创造了一个外观。

<?php

namespace VimeoServer\Facades;

use Illuminate\Support\Facades\Facade;
use VimeoServer\App\Repositories\Contracts\VimeoServerRepository;

class Vimeo extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return VimeoServerRepository::class;
    }
}

我在服务提供商内注册了它。

/**
 * Register the application services.
 *
 * @return void
 */
public function register()
{
    if ($this->app->runningInConsole()) {
        $this->publishes([
            __DIR__ . '/../config/vimeo.php' => config_path('vimeo.php'),
        ]);
    }

    $this->app->singleton(VimeoServerRepository::class, function () {
        /*
         * Config.
         */
        $config = config('vimeo.connection');

        /*
         * Repository.
         */
        $repository = new ConcreteVimeoServerRepository($config);

        return $repository;
    });
}

我注册了服务提供商:

 VimeoServer\App\Providers\VimeoServerServiceProvider::class 

和别名:

 'Vimeo' => VimeoServer\Facades\Vimeo::class 

我正在尝试在视频控制器中使用它。

如果我在控制器中添加use VimeoServer\Facades\Vimeo,一切都按预期工作。

当我尝试使用\Vimeo别名时,会出现问题,找不到外观类。

 "message": "Class 'VimeoServer\\Facades\\Vimeo' not found" 

0 个答案:

没有答案