title: laravel eloquent create without fillable attribute
body: <p>this is my model : </p>
  
  <pre><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Model;
  use App\Models\BaseModel;
  use Illuminate\Support\Facades\Hash;
  
  class Domain extends BaseModel {
  
      protected $fillable = ['user_id', 'name', 'username', 'password', 'plan', 'payment', 'status', 'duration'];
      protected $hidden = ['password'];
  
      protected $rules = [
          'user_id' =&gt; [
              'required',
              'integer',
              'exists:users,id'
          ],
          'name' =&gt; [
              'required',
              'regex:/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z][a-z0-9-]{0,61}[a-z0-9])$/i',
              'unique:domains,name',
          ],
          'username' =&gt; [
              'sometimes',
              'nullable',
              'min:1',
              'max:16',
              'unique:domains,username',
          ],
          'password' =&gt; [
              'sometimes',
              'nullable',
              'min:0',
              'max:65',
          ],
          'plan' =&gt; [
              'sometimes',
              'nullable',
          ],
          'payment' =&gt; [
              'required',
              'string',
              'max:40',
              'in:webpos,cheque'
          ],
          'status' =&gt; [
              'sometimes',
              'nullable',
              'integer',
              'in:0,1',
          ],
          'duration' =&gt; [
              'sometimes',
              'nullable',
              'integer',
              'min:1',
              'max:10',
          ]
      ];
  
      protected $attributeNames = [
          'user_id' =&gt; 'Domain Sahibi',
          'name' =&gt; 'Domain Adı',
          'payment' =&gt; 'Ödeme Şekli',
          'status' =&gt; 'Domain Durumu',
          'duration' =&gt; 'Domain Süresi'
      ];
  
      public function setUsernameAttribute($value)
      {
          if ( is_null($value) ){
              $value = str_random(16);
          }
          $this-&gt;attributes['username'] = strtolower($value);
      }
  
      public function setPasswordAttribute($value)
      {
          if ( is_null($value) ){
              $value = str_random(16);
          }
          $this-&gt;attributes['password'] = Hash::make($value);
      }
  
      public function setPlanAttribute($value)
      {
          $this-&gt;attributes['plan'] = strtolower($value);
      }
  
      public function setNameAttribute($value){
          $this-&gt;attributes['name'] = str_replace('www.', '', $value);
      }
  
      public function setStatusAttribute($value)
      {
          if ( is_null($value) ){
              $value = 0;
          }
  
          $this-&gt;attributes['status'] = (int)$value;
      }
  
      public function setDurationAttribute($value)
      {
          if ( is_null($value) ){
              $value = 1;
          }
  
          $this-&gt;attributes['duration'] = $value;
      }
  }
  </code></pre>
  
  <p>this is my controller : </p>
  
  <pre><code>$req = $request-&gt;only(['user_id', 'name', 'payment', 'status', 'duration']);
  $result = $this-&gt;domain-&gt;add($req);
  </code></pre>
  
  <p>bu i got this error</p>
  
  <blockquote>
    <p>"Invalid Request SQLSTATE[HY000]: General error: 1364 Field 'username' doesn't have a default value (SQL: insert into <code>domains</code> (<code>user_id</code>, <code>name</code>, <code>payment</code>, <code>status</code>, <code>duration</code>, <code>updated_at</code>, <code>created_at</code>) values (1, deneme-1.com, cheque, 0, 1, 2017-07-03 13:58:03, 2017-07-03 13:58:03))"</p>
  </blockquote>
  
  <p>why is the username and password go to the sql ?</p>
  
  <p>i added these to fillable array. i can't figure out it why didn't work it ?</p>
  
  <p>i don't want that username and password come with request . i want to set default str_random. but not wokring ? </p>
  
  <p>where is the problem ?</p>
  
  <p>and is it the right way to set the default attributes for null come attributes ?</p>