Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/public_html/app/Modules/Testimonials/Models/ |
<?php
namespace App\Modules\Testimonials\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Testimonial extends Model
{
use SoftDeletes;
/**
* The database table used by the model.
*
* @var string
*/
protected $table="testimonials";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['user_name','user_email','body','is_active','posted_at'];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['posted_at','deleted_at'];
/**
* @param $value
* @return string
*/
public function getExcerptAttribute($value)
{
return strip_tags(str_limit($this->body,250));
}
/**
* Get the posted at attribute
*
* @param string $value
* @return string
*/
public function getPostedAtAttribute($value)
{
$date = Carbon::createFromFormat('Y-m-d H:i:s',$value);
return $date->format('d F Y');
}
public function getPostedAtFormatedAttribute($value)
{
$date = Carbon::createFromFormat('d F Y',$this->posted_at);
return $date->format('D, d F Y');
}
}