38 lines
896 B
PHP
38 lines
896 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Interfaces\MovieDbInterface;
|
|
use App\Services\OmdbService;
|
|
use Illuminate\Support\Facades\Blade;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(MovieDbInterface::class, OmdbService::class);
|
|
|
|
Blade::directive('role', function ($role) {
|
|
return "<?php if(auth()->user()->hasRole({$role})) : ?>";
|
|
});
|
|
|
|
Blade::directive('endrole', function ($role) {
|
|
return "<?php endif; ?>";
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
if (app()->environment('production')) {
|
|
URL::forceScheme('https');
|
|
}
|
|
}
|
|
}
|