title: LARAVEL 5.5 - Insert Data into Database from FORM with Eloquent Model
body: <p>I have a problem with inserting Data into Database.</p>
  
  <p>All i have done till now is :</p>
  
  <p>Create a Model with Controller and Migration via:</p>
  
  <pre><code>php artisan make:model Cars -mcr
  </code></pre>
  
  <p><br/>
  So, now all of my files looks this way :</p>
  
  <h2>Cars - Model</h2>
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Cars extends Model
  {
  
  }
  </code></pre>
  
  <h2>AddCar.blade.php - View</h2>
  
  <pre><code>&lt;form action="{{ action('CarsController@store') }}" method="post"&gt;
      {{ csrf_field() }}
      &lt;input type="text" name="brand" placeholder="Marka"&gt;
      &lt;input type="text" name="model" placeholder="Model"&gt;
      &lt;input type="text" name="doors" placeholder="Ilość drzwi"&gt;
      &lt;input type="text" name="priceHour" placeholder="Cena za godzinę"&gt;
      &lt;input type="text" name="priceDay" placeholder="Cena za dzień"&gt;
      &lt;input type="text" name="priceWeek" placeholder="Cena za tydzień"&gt;
      &lt;input type="text" name="priceMonth" placeholder="Cena za miesiąc"&gt;
      &lt;input type="text" name="priceYear" placeholder="Cena za rok"&gt;
      &lt;input type="submit" value="Osadź"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <h2>CarsController - Controller</h2>
  
  <pre><code>namespace App\Http\Controllers;
  
  use App\Cars;
  use Illuminate\Http\Request;
  
  class CarsController extends Controller
  {
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function index()
      {
          return "test";
      }
  
      /**
       * Show the form for creating a new resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function create()
      {
  
      }
  
      /**
       * Store a newly created resource in storage.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return \Illuminate\Http\Response
       */
      public function store(Request $request)
      {
          $cars = new Cars;
          $cars-&gt;brand = $request-&gt;input('brand');
          $cars-&gt;brand = $request-&gt;input('model');
          $cars-&gt;brand = $request-&gt;input('type');
          $cars-&gt;brand = $request-&gt;input('doors');
          $cars-&gt;priceHour = $request-&gt;input('priceHour');
          $cars-&gt;priceDay = $request-&gt;input('priceDay');
          $cars-&gt;priceWeek = $request-&gt;input('priceWeek');
          $cars-&gt;priceMonth = $request-&gt;input('priceMonth');
          $cars-&gt;priceYear = $request-&gt;input('priceYear');
          $cars-&gt;save();
          return redirect('admin.AddCar');
      }
  </code></pre>
  
  <h2>web.php - Routing</h2>
  
  <pre><code>Route::resource('/cars', 'CarsController');
  </code></pre>
  
  <h2>Migration</h2>
  
  <pre><code>use Illuminate\Support\Facades\Schema;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Database\Migrations\Migration;
  
  class CreateCarsTable extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('cars', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('brand');
              $table-&gt;string('model');
              $table-&gt;string('type');
              $table-&gt;integer('doors');
              $table-&gt;string ('priceHour')-&gt;nullable();
              $table-&gt;string('priceDay')-&gt;nullable();
              $table-&gt;string('priceWeek')-&gt;nullable();
              $table-&gt;string('priceMonth')-&gt;nullable();
              $table-&gt;string('priceYear')-&gt;nullable();
              $table-&gt;timestamps();
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::dropIfExists('cars');
      }
  }
  </code></pre>
  
  <p><br/></p>
  
  <p>Error I receiving after fill out all fields and click "Osadz" = submit is:</p>
  
  <blockquote>
    <p>SQLSTATE[HY000]: General error: 1364 Field 'model' doesn't have a
    default value (SQL: insert into <code>cars</code> (<code>brand</code>, <code>priceHour</code>,
    <code>priceDay</code>, <code>priceWeek</code>, <code>priceMonth</code>, <code>priceYear</code>, <code>updated_at</code>,
    <code>created_at</code>) values (3, 3, 53, 3, 35, 3, 2018-01-30 09:36:57,
    2018-01-30 09:36:57))</p>
  </blockquote>
  
  <p><br/>
  <br/></p>
  
  <p>And my question is, what default value is missing in my code ? </p>