jeudi 22 août 2019

Why Laravel changes date automatically?

There is field in database: create_date in timestamp type.

It has value: 2019-08-22 14:51:59

When I get data from table I see that value of field create_date was changed to: 2019-08-22 18:51:59. Instead real value 2019-08-22 14:51:59.

Why?

Model is:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Scopes\StatusScope;

class Event extends Model
{
    public $timestamps = false;

    public $table = 'events';

    public $fillable = ['status', 'name', 'date', 'creator_id', 'create_date'];

    protected $primaryKey = 'idEvent';

    public function visitors()
    {
        return $this->hasMany('App\Visitor', 'idEvent', 'idEvent');
    }

    public function creator()
    {
        return $this->hasOne('App\User', 'id', 'creator_id');
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire