1
0
Fork 0

Adding app/View/Components/RaceIcon.php

This commit is contained in:
Henrik Hautakoski 2021-07-18 17:38:35 +02:00
parent f84a0579f2
commit c662816c33

View 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);
}
}