问题描述
我目前正在使用LiveWire在Laravel中开发优惠券/折扣功能
public function refreshCart(Request $request = NULL)
{
$this->cart = Session::has('cart') ? Session::get('cart') : null;
// Reset prevIoUsly entered coupon
$this->coupon = NULL;
// Check if new coupon code is valid
if ($this->couponCode){
$coupon = Coupon::where('code',"=",$this->couponCode)->first();
if ($coupon !== NULL){
$this->coupon = $coupon;
}
}
}
问题是,这不是很安全。
我想限制对Coupon::where(...)
所以
是否可以使用默认的Laravel函数来实现此目的,还是应该为此创建数据库方案? 我该如何实现?我没有发现关于stackoverflow的任何信息。
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)