i make a serviceprovider and add provider in app.php but how can i use it ?
<?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 class is in App\Helpers\api\gg folder and i want use this class everywhere like that
gg::isReady();
app.php
'providers' => [
...
App\Providers\ApiServiceProvider::class,
...
]
homecontroller@index
public function index()
{
//how can use this provider in there ?
return view('pages.home');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire