samedi 19 novembre 2016

SQLSTATE[42S22]: Column not found: 1054 Unknown column laravel 5.1

I have this QueryException

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `comentarios` (`NombreUsuario`, `CorreoUsuario`, `TelefonoUsuario`, `Asunto`, `Mensaje`, `FecComentario`, `updated_at`, `created_at`) values (Andres, poc@dw.xom, 124422432, Andres es genial, vffgdf, 2016-11-20 03:34:45, 2016-11-20 03:44:18, 2016-11-20 03:44:18))

and this is my sql for laravel 5.1

public function store(Request $request)
    {

        \JuanSapo\ContadorT::create([
            'NombreUsuario' => $request['nombres'],
            'CorreoUsuario' => $request['email'],
            'TelefonoUsuario' => $request['numContacto'],
            'Asunto' => $request['asunto'],
            'Mensaje' => $request['mensaje'],
            'FecComentario' => $request['fecha']

            ]);

            return view('contacto');
    }

i can see, i have two dates more just in the end and this look on my sql's mistake,

This is my auth.php

<?php

return [

    'driver' => 'eloquent',

    'model' => JuanSapo\User::class,
    'model' => JuanSapo\ContadorT::class,

    'table' => 'users',
    'table' => 'comentarios',

    'password' => [
        'email'  => 'emails.password',
        'table'  => 'password_resets',
        'expire' => 60,
    ],

];

this is my User.php

<?php

namespace JuanSapo;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;

    protected $table = 'users';

    protected $fillable = ['name', 'email', 'password'];

    protected $hidden = ['password', 'remember_token'];
}

This is my contadotT.php

<?php

namespace JuanSapo;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class ContadorT extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;


    protected $table = 'comentarios';

    protected $fillable = ['NombreUsuario', 'CorreoUsuario', 'TelefonoUsuario','Asunto','Mensaje','FecComentario'];

    protected $hidden = ['contador'];
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire