
PK 
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Productreview extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'product_reviews';
use SoftDeletes;
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'review_detail','created_at','updated_at','visitor'
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
// protected $visible = [];
/**
* Scope a query to only include active users.
*
* @param \Illuminate\Database\Eloquent\Productreview $query
* @return \Illuminate\Database\Eloquent\Productreview
*/
public function scopeActive($query)
{
return $query->where('isactive', 1);
}
public function scopeIsDelete($query)
{
return $query->where('isdelete', 1);
}
public function getCreatedAtAttribute($date)
{
return Carbon::createFromFormat('Y-m-d H:i:s', $date)->diffForHumans();//format('d-M-Y h:i A');
//Carbon::createFromFormat('Y-m-d H:i:s', $value->created_at)->diffForHumans()
}
public function getUpdatedAtAttribute($date)
{
return Carbon::createFromFormat('Y-m-d H:i:s', $date)->diffForHumans();//;
}
}


PK 99