Skip to content

Instantly share code, notes, and snippets.

@MaheKarim
Created September 24, 2019 19:14
Show Gist options
  • Save MaheKarim/f1be9b1d29e9ed3273a008cb3d5d97fd to your computer and use it in GitHub Desktop.
Save MaheKarim/f1be9b1d29e9ed3273a008cb3d5d97fd to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Auth; // Must Must use
use Illuminate\Support\Facades\Blade; // Must Must use
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// custome direction
Blade::if('admin', function () {
return auth()->check() && auth()->user()->role_id == 1;
// admin is just a directive name that i want to create
// return korbe authentication check korbe login ache kina
// && auth () jodi login means user hoy ebong er role ID 1 kina
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment