2016-11-20 26 views
0

が、私はこのQueryExceptionSQLSTATE [42S22]:カラム見つかりません:1054不明列laravel 5.1

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, [email protected], 124422432, Andres es genial, vffgdf, 2016-11-20 03:34:45, 2016-11-20 03:44:18, 2016-11-20 03:44:18)) 

を持っており、これは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'); 
    } 

のための私のsqlです、私は2つを持っています

この

は私auth.phpで、より多くのちょうど終わり、私のSQLのミスでこの表情にさかのぼり

<?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, 
    ], 

]; 

これは私の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']; 
} 

ですこれはあなたがLaravelはcrated_at & update_atフィールドを追加しませんので、ごContadorTモデルクラスにpublic $timestamps = false;を追加する必要があり、私の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']; 
} 
+4

可能な複製http://stackoverflow.com/questions/28277955/laravelunknown-column-updated-at –

答えて

1

ですクエリ内で

+0

それは本当だった ありがとう – camilosama

関連する問題