Files
hyperf_service/app/Model/MaterialStock.php
LAPTOP-7SGDREK0\shiweijun 3f7d8f5cad feat:depotPurchase
2025-02-05 16:11:00 +08:00

52 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\MaterialCode;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property int $material_id
* @property int $depot_id
* @property int $supplier_id
* @property string $current_stock
* @property string $unit_price
* @property int $is_del
* @property string $create_time
* @property string $update_time
*/
class MaterialStock extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'material_stock';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'material_id' => 'integer', 'depot_id' => 'integer', 'supplier_id' => 'integer', 'is_del' => 'integer'];
const CREATED_AT = 'create_time';
const UPDATED_AT = 'update_time';
public function getMaterial(int $material_id,int $depot_id,int $supplier_id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('is_del',MaterialCode::IS_NO_DEL)
->where('material_id',$material_id)
->where('depot_id',$depot_id)
->where('supplier_id',$supplier_id)
->first();
}
}