I am using latest Laravel. I have a model Car
- id | name | * timestamp columns
:
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Car extends Model{
protected $fillable = [
'name'
];
}
Cars migration:
public function up()
{
Schema::create('cars', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('name')->nullable();
$table->timestamps();
});
I am trying to save new row in cars
table in the controller:
$car = new Car();
$car->name = 'example';
$car->save();
, but for $car->save()
, I am getting this error:
Call to undefined method App\Models\Car::setCreatedAt()
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2MdoXJA
via IFTTT
Aucun commentaire:
Enregistrer un commentaire