mercredi 23 décembre 2015

Error 500 with save() method of eloquent/laravel

I want to save an object with Laravel's eloquent but I get error 500 when trying to save.

This is my model code:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Categorie extends Model
{

}

and this is my action:

public function addCategorie() {
    $input = Input::all();
    $categorie = new Categorie;
    $categorie->libelle = $input['label'];
    $categorie->save();
    return $categorie;
}

When I use print_r($categorie) after the save method I get a result, but when I use the save() method I got this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `categories` (`libelle`, `description`, `updated_at`, `created_at`) values (sss, zzz, 2015-12-23 16:20:30, 2015-12-23 16:20:30 ))



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire