ldc-crm/app/Models/BrandStat.php
2021-10-29 12:53:46 +02:00

36 lines
705 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
class BrandStat extends Model
{
use HasFactory;
public $timestamps = false;
public $casts = [
'created_at' => 'date'
];
protected $fillable = [
'active', 'inactive',
'old_accounts', 'new_accounts',
'total_accounts', 'total_opt_in'
];
protected static function booted()
{
static::creating(function (BrandStat $stat) {
$stat->created_at = Carbon::now();
});
}
public function brand()
{
return $this->belongsTo(Brand::class);
}
}