A noob question: I have not been successful changing my timestamps in Laravel. I even went into my Model.php to change my timestamps but still not successful. Hope someone can guide me on this matter. As I would like to change my timestamp to:
const CREATED_AT = 'creation_date';
const UPDATED_AT = 'last_update';
Below is the my Model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Events extends Model
{
const CREATED_AT = 'creation_date';
const UPDATED_AT = 'last_update';
public function event_type(){
return $this->belongsTo('App\EventsType');
}
public function time(){
$this->hasMany('App\Time');
}
// protected $fillable = [
// 'name', 'description','date_of_event','location','is_Active',
// ];
}
My migration is below:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('events', function (Blueprint $table) {
$table->increments('id');
$table->integer('event_id');
$table->string('name');
$table->text('description');
$table->datetime('date_of_event');
$table->timestamps();
$table->text('location');
$table->text('note');
$table->boolean('is_Active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('events');
}
}