You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
860 B

3 years ago
<?php
namespace App\Models;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
class CommonModel extends Model
{
use DynamicallyTableModelTrait;
use FilterRequestColumnModelTrait;
protected $table;
protected $guarded = [];
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
'deleted_at' => 'datetime:Y-m-d H:i:s',
];
public $glue = ",";
protected function serializeDate(DateTimeInterface $date)
{
return $date->format(Carbon::parse($date)->toDateTimeString());
}
// 获取数据库里参数配置
public function getParameterValue($id){
$details = ParameterDetail::where('id',$id)->value('value');
return $details??'';
}
}