-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Country.php
46 lines (39 loc) · 892 Bytes
/
Country.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\View\Components\Index;
use App\Abstracts\View\Component;
class Country extends Component
{
/**
* The Country country.
*
* @var string
*/
public $country;
/**
* The Country code.
*
* @var string
*/
public $code;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($code) {
$this->code = $code;
$this->country = trans('general.na');
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
if (! empty($this->code) && array_key_exists($this->code, trans('countries'))) {
$this->country = trans('countries.' . $this->code);
}
return view('components.index.country');
}
}