저는 serviceprovider를 만들고 app.php에 공급자를 추가하지만 어떻게 사용할 수 있습니까?laravel 서비스 공급자 만들기
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Helpers\api\gg\gg;
class ApiServiceProvider extends ServiceProvider
{
protected $defer = true;
public function boot()
{
}
public function register()
{
$this->app->bind(gg::class, function()
{
return new gg;
});
}
public function provides()
{
return [gg::class];
}
}
GG 클래스는 응용 프로그램 \ 도우미 \ API를 \ gg를 폴더에 내가 그
gg::isReady();
app.php처럼 사방이 클래스를 사용하려면
'providers' => [
...
App\Providers\ApiServiceProvider::class,
...
]
homecontroller의 @ 지수
public function index()
{
//how can use this provider in there ?
return view('pages.home');
}
내가 시도 할 것이다. 감사 – Hanik