Adding app/View/Components/RaceIcon.php
This commit is contained in:
parent
f84a0579f2
commit
c662816c33
1 changed files with 24 additions and 0 deletions
24
app/View/Components/RaceIcon.php
Normal file
24
app/View/Components/RaceIcon.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Character;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RaceIcon extends Icon
|
||||
{
|
||||
protected $prefix = 'races';
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Character $character)
|
||||
{
|
||||
$race = Str::of($character->race)->lower()->replace(' ', '');
|
||||
$name = sprintf("%s_%s", $race, $character->gender);
|
||||
|
||||
parent::__construct($name);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue