如何检查用户的price_plan_id是否存在?

时间:2018-12-17 12:58:56

标签: php laravel

我正在laravel网站上制定免费的奖金计划。我想如果用户已经申请了奖金计划,那么他应该不能再次申请它。我希望如果price_plan_id已经在该用户标识的plan_logs中,则应该返回错误。

我可以使用以下代码检查记录是否为用户存在,但我只想查找记录是否存在。

 $plan = PlanLog::where('user_id', $user->id)->where('pricing_plan_id', $plan->cat_id)->get();

    if (empty($plan)) {
       return redirect()->back()->with('type','danger')->with('message','please add funds atleast once');
    }

0 个答案:

没有答案