title: Undefined array key 0 - Laravel custom ID
body: <p>I am trying to generate custom id using the Laravel <a href="https://laravelarticle.com/laravel-custom-id-generator?fbclid=IwAR3nvoPrIF2wgnu3RLYI9F7VH75DZ-ZpfM2r4JeGfSxepp-hWb0H7Gl_OKs" rel="nofollow noreferrer">Custom</a> ID package but I am getting Undefined array key 0. I followed the provide code, and i don't why i am getting this error, i tried both in the controller and the model. When i add 'field' =&gt; 'name', it works but generates the same code, by default it should use the id column but that gives me the error.</p>
  <pre><code>class Product extends Model
  {
      use SoftDeletes;
  
      protected $fillable = [
          'id', 'name', 'description', 'product_category_id', 'price', 'stock', 'stock_defective', 'barcode', 'barcodeID',
      ];
  
      public function category()
      {
          return $this-&gt;belongsTo('App\ProductCategory', 'product_category_id')-&gt;withTrashed();
      }
  
      public function solds()
      {
          return $this-&gt;hasMany('App\SoldProduct');
      }
  
      public function receiveds()
      {
          return $this-&gt;hasMany('App\ReceivedProduct');
      }
  
      public static function boot()
      {
          parent::boot();
          self::creating(function (Product $model) {  
              $model-&gt;barcodeID = IdGenerator::generate(['table'=&gt;'products', 'length'=&gt; 4, 'prefix'=&gt;date('y') ]);
          });
      }
      
  }
  </code></pre>
  <p>the database:</p>
  <pre><code>$table-&gt;unsignedinteger('barcodeID')-&gt;nullable();
  </code></pre>
  <p>any help?</p>
  <p>so now, i am using the name field as the id field giving me an error</p>
  <pre><code> public static function boot()
  {
      parent::boot();
      self::creating(function (Product $model) {  
          $model-&gt;barcodeID = IdGenerator::generate(['table'=&gt;'products', 'field' =&gt; 'name', 'length'=&gt; 6, 'prefix'=&gt; date('my') ]);
      });
  }
  </code></pre>
  <p>but it doesn't output unique code, it output the same code. why? i want it to increment the code as 082101, 082102...etc</p>
  <p>Thanks</p>