PHP code example of jefremassingue / spatie-permission-generate

1. Go to this page and download the library: Download jefremassingue/spatie-permission-generate 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/ */

    

jefremassingue / spatie-permission-generate example snippets

 php
// Run synchronizelPermission method to generate permissions
    $hasGenarate = \Jefre\SpatiePermissionGenerate\SpatiePermissionGenerate::synchronizelPermission();

 php
// Set the following keys in your `.env` file:

SPG_CONTROLLERS_ROOT_PATH='app/Http/Controllers'
SPG_IGNORE_CLASSES_FILES='Controller,Helper\Upload, Other classes you want ignore'
SPG_CONTROLLER_CLASSES_SUFFIX='Controller,_controller'
SPG_IGNORE_METHODS_AND_FUNCTIONS='__construct'
SPG_DEFAULT_GUARD='web'

 php


namespace App\Http\Controllers\API;

...

class UserController extends Controller
{
    public function __construct() {}
    public function index(){}
    public function create(){}
    public function store(Request $request){}
    public function show($id){}
    public function edit($id){}
    public function update(Request $request, $id){}
    public function destroy($id){}
}