PHP code example of hexters / hexa-lite

1. Go to this page and download the library: Download hexters/hexa-lite 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/ */

    

hexters / hexa-lite example snippets


use Filament\Panel;
use Hexters\HexaLite\HexaLite;
 
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            HexaLite::make(),
        ]);
}

use Hexters\HexaLite\Traits\HexAccess;

. . .

use HexAccess;

protected static ?string $permissionId = 'access.user';

protected static ?string $descriptionPermission = 'Admin can manage User accounts';

/**
 * Additional permission (optional)
 * You can add it or not depending on the needs of your application.
 */
protected static ?array $subPermissions = [
    'access.user.create' => 'Can Create',
    'access.user.edit' => 'Can Edit',
    'access.user.delete' => 'Can Delete',
];

public static function canAccess(): bool
{
    return hexa()->can(static::$permissionId);
}

. . .

Tables\Actions\EditAction::make()
    ->visible(hexa()->can('access.user.edit')),

/**
 * @param  array<string, mixed>  $parameters
 */
public static function canAccess(array $parameters = []): bool
{
    return hexa()->can('access.user.edit');
}

hexa()->can('hexa.admin')

auth()->user()?->can('hexa.admin')

use Illuminate\Support\Facades\Gate;

. . .

Gate::allows('hexa.admin')
bash
php artisan hexa:install
bash
php artisan migrate
bash
php artisan hexa:account --create