PHP code example of karelvanzijl / sanctum-tokens

1. Go to this page and download the library: Download karelvanzijl/sanctum-tokens 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/ */

    

karelvanzijl / sanctum-tokens example snippets


use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make(),
    ];
}


use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make()->hideAbilities(),
    ];
}


use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make()->defaultAbilities(['foo', 'bar-baz']),
    ];
}


php artisan vendor:publish --provider="Karelvanzijl\SanctumTokens\ToolServiceProvider"