采购单处理

This commit is contained in:
root
2025-09-22 15:50:36 +08:00
parent e12d5951e4
commit bdefd69a13
6 changed files with 254 additions and 27 deletions
+16 -1
View File
@@ -3,9 +3,13 @@
namespace app\common\model;
use support\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class PurchaseOrders extends Model
{
use SoftDeletes;
/**
* The connection name for the model.
*
@@ -40,10 +44,21 @@ class PurchaseOrders extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'po_no', 'pi_no', 'buyer_id', 'contract_file', 'status', 'remark', 'created_at', 'updated_at'];
protected $fillable = ['id', 'po_no', 'pi_no', 'buyer_id', 'buyer_name', 'contract_file', 'status', 'remark', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function items()
{
return $this->hasMany(PurchaseOrderItems::class, 'purchase_order_id', 'id');
}
public function buyer()
{
return $this->hasOne(User::class, 'id', 'buyer_id');
}
}