public function switchToQueen($lid) { if (new static() != new Queen()) { $card = static::where('link_id', $lid)->where('shuffle', false)->where('min_direct', '>', $this->min_queen)->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 Queen(); $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 Queen!"; } return "You Cant Switch Line!"; }