Ошибка в save () после функции в Laravel - PullRequest
0 голосов
/ 11 апреля 2020

Я пытаюсь реализовать метод save() после функции self::restrictionMinimunBid($ request, $ karateka, $ bid), но получаю следующую ошибку: "Method App\\Http\\Controllers\\BidController::save does not exist."

Вот мой код:

$bid = Bid::where('id_participants', '=', $request->id_participant)
        ->where('id_karatekas', '=',$market->id_karatekas)
        ->where('bid', '=',$request->bid);

        if(!$bid->count()){
         $bid->id_market = $market->id;
         $bid->id_group = $market->id_group;
         $bid->id_karatekas = $market->id_karatekas;                        
         $bid->id_participants = $request->id_participant;                                    
         self::restrictionMinimunBid($request, $karateka, $bid);
         $bid->save();                                    
         $response = array('code' => 200, 'Bid' => $bid, 'msg' => 'Bid created'); 
         }else{
         $response = array('code' => 400, 'error_msg' => "Bid already registered.");
         }
 public function restrictionMinimunBid(Request & $request, $karateka, & $bid)
    {
        $allKaratekas = Karateka::all()
        ->map(function ($allKaratekas) use ($karateka, $request, $bid){
                if($karateka->id == $allKaratekas->id ){
                   if($request->bid > $allKaratekas->value){
                    $bid->bid = $request->bid;
                    $msg ="The bid is more than the value of karateka";
                    var_dump($msg);

                   }
                   else{
                       $error ="The bid is less than the value ofmkarateka";
                       var_dump($error);
                   }
                }
        });
    }

...