1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\admin\model;
- use support\Db;
- use support\Model;
- /**
- * 医疗产品
- * Class Users
- * @package app\admin\model
- */
- class Appointment extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'medical_care_appointment';
- public $timestamps = false;
- /**
- * Notes:获取产品列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: QJF
- * Date: 2022/9/23
- */
- public static function geMentList(int $page, int $limit,$keywords)
- {
- $list = static::select('*')
- ->with(['Category','Shop'])
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('appointment_name', 'like', '%' . $keywords . '%');
- })
- ->where('appointment_del',0)
- ->orderBy('appointment_create_time','DESC')
- ->forPage($page, $limit)
- ->get();
- $count = static::when($keywords != '', function ($query) use ($keywords){
- $query->where('appointment_name', 'like', '%' . $keywords . '%');
- }) ->where('appointment_del',0)->count();
- return [$list, $count];
- }
- public function getAppointmentCreateTimeAttribute($value)
- {
- return date('Y-m-d H:i:s', $value);
- }
- public function Category(){
- return $this->belongsTo(Category::class,'appointment_category_id','category_id');
- }
- //关联店铺
- public function Shop(){
- return $this->belongsTo(MerchantShop::class,'appointment_shop_id','shop_id');
- }
- }
|