ray sn0w ray sn0w - 2 months ago 4x
PHP Question

Base table or view not found: 1146 Table Laravel 5

Im getting this error when I try to save data to mysql using Laravel 5, other forms and save() methods work fine but this one:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sistemal5.cotizacions' doesn't exist (SQL: insert into `cotizacions` (`customer_id`, `total`, `updated_at`, `created_at`) values (1501, 150.69, 2015-05-11 03:16:25, 2015-05-11 03:16:25))

Here is my Controller store method:

public function store(CotFormRequest $request)
$quote = new Cotizacion;
$quote->customer_id = Input::get('data.clientid');
$quote->total = Input::get('data.totalAftertax');

And here is my model:

<?php namespace App\Models\Cotizacion;

use Illuminate\Database\Eloquent\Model;

class Cotizacion extends Model {


I must be overlooking something really obvious cause i cant understand why Laravel is adding an "S" the table is cotizacion not cotizacions.

How can i troubleshoot this?


I'm guessing Laravel can't determine the plural form of the word you used for your table name.

Just specify your table in the model as such:

class Cotizacion extends Model{
    public $table = "cotizacion";