Bulletinboard/app/Providers/AppServiceProvider.php

35 lines
619 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Blade::if("admin", function () {
if(auth()->user() && auth()->user()->role->name == "Admin") {
return 1;
}
return 0;
});
}
}