54 lines
967 B
PHP
54 lines
967 B
PHP
<?php
|
|
|
|
namespace App\View\Components;
|
|
|
|
use Illuminate\View\Component;
|
|
|
|
use App\Models\Card as CardModel;
|
|
|
|
class Card extends Component
|
|
{
|
|
/**
|
|
* Card number
|
|
*/
|
|
public int $number;
|
|
|
|
/**
|
|
* The card
|
|
*/
|
|
public CardModel $card;
|
|
|
|
/**
|
|
* If the card is flipped
|
|
*/
|
|
public bool $flipped;
|
|
|
|
|
|
/**
|
|
* If the card is flagged as winning.
|
|
*/
|
|
public bool $win;
|
|
|
|
/**
|
|
* Create a new component instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(int $number, CardModel $card, bool $flipped = false, bool $win = false)
|
|
{
|
|
$this->number = $number;
|
|
$this->card = $card;
|
|
$this->flipped = $flipped;
|
|
$this->win = $win;
|
|
}
|
|
|
|
/**
|
|
* Get the view / contents that represent the component.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View|\Closure|string
|
|
*/
|
|
public function render()
|
|
{
|
|
return view('components.card');
|
|
}
|
|
}
|