54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
use Hyperf\Database\Model\Builder;
|
|
use Hyperf\Database\Model\Collection;
|
|
use Hyperf\DbConnection\Model\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $cycle_id
|
|
* @property int $city_id
|
|
* @property int $kitchen_id
|
|
* @property int $image_id
|
|
* @property string $name
|
|
* @property string $remark
|
|
* @property string $sku_ids
|
|
* @property string $create_time
|
|
* @property string $update_time
|
|
*/
|
|
class Purchase extends Model
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'purchase';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = [];
|
|
protected array $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*/
|
|
protected array $casts = ['id' => 'integer', 'meal_id' => 'integer', 'image_id' => 'integer'];
|
|
|
|
const string CREATED_AT = 'create_time';
|
|
const string UPDATED_AT = 'update_time';
|
|
|
|
/**
|
|
* @param int $cycleId
|
|
* @param int $kitchenId
|
|
* @return Builder[]|Collection
|
|
*/
|
|
public function getListByCycleIdAndKitchenId(int $cycleId, int $kitchenId): Collection|array
|
|
{
|
|
return $this->where('cycle_id',$cycleId)->where('kitchen_id',$kitchenId)->select('id','name','remark','sku_ids','image_id')->get();
|
|
}
|
|
}
|