mega-commit: migrations, controllers, models, etc.
This commit is contained in:
parent
9732135e90
commit
2c6745e812
70 changed files with 2124 additions and 400 deletions
51
app/View/Components/SeatChooser.php
Normal file
51
app/View/Components/SeatChooser.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Room;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class SeatChooser extends Component
|
||||
{
|
||||
|
||||
public int $room_id;
|
||||
public int $showing_id;
|
||||
public Room $room;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(int $room_id, int $showing_id)
|
||||
{
|
||||
$this->room_id = $room_id;
|
||||
$this->room = Room::find($room_id);
|
||||
$this->showing_id = $showing_id;
|
||||
}
|
||||
|
||||
public function matrixGenerate() {
|
||||
$matrix = [];
|
||||
for ($row = 1; $row <= $this->room->room_rows; $row++) {
|
||||
$matrix[$row] = [];
|
||||
for ($column = 1; $column <= $this->room->room_columns; $column++) {
|
||||
$matrix[$row][$column] = 0;
|
||||
}
|
||||
}
|
||||
return $matrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.seat-chooser', [
|
||||
'room' => $this->room,
|
||||
'seatmatrix' => $this->matrixGenerate(),
|
||||
'showing_id' => $this->showing_id,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue