/**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($lid)
 {
     $directCount = Link::where('sp_link_id', $lid)->count();
     $ten = new Ten();
     $ten->link_id = $lid;
     $ten->min_direct = $directCount;
     $ten->save();
     $cardline = new Cardline();
     $cardline->link_id = $lid;
     $ten->cardpoints()->save($cardline);
 }
예제 #2
0
 public function switchToTen($lid)
 {
     if (new static() != new Ten()) {
         $card = static::where('link_id', $lid)->where('shuffle', false)->where('min_direct', '>', $this->min_ten)->where('canSwitch', true)->first();
         $cardID = $card->id;
         $directCount = $card->min_direct;
         $card->delete();
         $cardline = Cardline::where('card_type', $this->cardtype)->where('card_id', $cardID)->delete();
         $card = new Ten();
         $card->link_id = $lid;
         $card->min_direct = $directCount;
         $card->save();
         $cardline = new Cardline();
         $cardline->link_id = $lid;
         $card->cardpoints()->save($cardline);
         return "You  Switch to Card Line 10!";
     }
     return "You  Cant Switch Line!";
 }