1@if (count($records) === 1)
2 I have one record!
3@elseif (count($records) > 1)
4 I have multiple records!
5@else
6 I don't have any records!
7@endif
1/**
2 * Create the component instance.
3 *
4 * @param string $alertType
5 * @return void
6 */
7public function __construct($alertType)
8{
9 $this->alertType = $alertType;
10}
1<option {{ $isSelected($value) ? 'selected="selected"' : '' }} value="{{ $value }}">
2 {{ $label }}
3</option>
1<?php
2
3namespace App\View\Components;
4
5use Illuminate\View\Component;
6
7class Alert extends Component
8{
9 /**
10 * The alert type.
11 *
12 * @var string
13 */
14 public $type;
15
16 /**
17 * The alert message.
18 *
19 * @var string
20 */
21 public $message;
22
23 /**
24 * Create the component instance.
25 *
26 * @param string $type
27 * @param string $message
28 * @return void
29 */
30 public function __construct($type, $message)
31 {
32 $this->type = $type;
33 $this->message = $message;
34 }
35
36 /**
37 * Get the view / contents that represent the component.
38 *
39 * @return \Illuminate\View\View|\Closure|string
40 */
41 public function render()
42 {
43 return view('components.alert');
44 }
45}