PHP code example of thoth-pharaoh / permission

1. Go to this page and download the library: Download thoth-pharaoh/permission library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thoth-pharaoh / permission example snippets

bash
php artisan migrate
bash
php artisan vendor:publish --tag=permission-config
bash
php artisan vendor:publish --tag=permission-database
bash
public function boot()
{
    // 動態綁定 groups <-> users 多對多 多型關聯
    Group::resolveRelationUsing('users', function ($groupModel) {
        return $groupModel->morphedByMany(User::class, 'groupable');
    });
}