time based permission laravel with spatie code example

Example 1: spatie/laravel-permission

// Install package
composer require spatie/laravel-permission

// config/app.php
'providers' => [
    // ...
    Spatie\Permission\PermissionServiceProvider::class,
];

// Publish config file
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

// Clear cache
php artisan optimize:clear
 # or
php artisan config:clear

// Run migration to create tables
php artisan migrate

Example 2: laravel permission

//install laravel permission with composer installer for Laravel 6.0 or higher
composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

Tags:

Misc Example