PHP code example of mykemeynell / laraveluuid

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

    

mykemeynell / laraveluuid example snippets



use ...;

class CreateUsersTable extends Migration
{
  // Include the UuidColumn trait into your migration class.
  // This will give you access to the necessary method to easily 
  // create the appropriate column.
  use \UuidColumn\Concern\UuidColumn;


  public function up()
  {
    Schema::create('users', function(Blueprint $table) {
    
      // Calling the createUuidColumn() method will add the column into your migration.
      // You can migrate this normally with PHP Artisan.
      $this->createUuidColumn($table, 'id);
      
      ...
    


use ...;
use UuidColumn\Concern\HasUuidObserver;

class User extends Authenticatable
{
    use ..., HasUuidObserver;
    
    ...


class User extends Authenticatable
{
    ...
    
    /**
     * Indicates if the IDs are auto-incrementing.
     *
     * @var bool
     */
    public $incrementing = false;
    
    /**
     * The "type" of the primary key ID.
     *
     * @var string
     */
    protected $keyType = 'string';
    
    ...

app/User.php