PHP code example of james322 / has-nano-id-laravel

1. Go to this page and download the library: Download james322/has-nano-id-laravel 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/ */

    

james322 / has-nano-id-laravel example snippets


return [

    'alphabet' => env('NANO_ID_ALPHABET', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-'),

    'size' => (int) env('NANO_ID_SIZE', 21)
];

use james322\HasNanoId\HasNanoId;

class User
{
    use HasNanoId;
}

use james322\HasNanoId\HasNanoId;

class User
{
    use HasNanoId;

    public $nano_id_key = 'custom_column'; // default 'public_key'
}

use james322\HasNanoId\HasNanoId;

class User
{
    use HasNanoId;

    public $nano_id_alphabet = 'abcdefg1234567890-'; // default '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-'

    public $nano_id_size = 14; // default 21
}