title: How to generate custom identification values in laravel?
body: <p>Good day guys, I have two(2) fields, <code>persondId</code> (primary key) which is auto incremented and <code>personCode</code> which should be a custom four(4) digits incremented value based on the <code>personId</code> field. </p>
  
  <p>For example when when a record is inserted into the <strong>persons</strong> table <code>personId</code> becomes <code>1</code> and <code>personCode</code> should become <code>0001</code> </p>
  
  <p>How do I accomplish this in laravel?</p>
  
  <p>Migration file:</p>
  
  <pre><code>public function up()
  {
      Schema::create('people', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('person-code');
          $table-&gt;string('name');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>Controller </p>
  
  <pre><code>public function store(Request $request)
  {
      //
  
      $person = new Person;
      $person-&gt;name = request('name');
  
      $person-&gt;save();
  }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>//Please how should my model look to accomplish this.
  </code></pre>