31 lines
774 B
PHP
31 lines
774 B
PHP
<?php
|
|
|
|
namespace App\View\Components;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\View\Component;
|
|
|
|
class LastFMCurrent extends Component {
|
|
public $track;
|
|
public $artUrl;
|
|
/**
|
|
* Create a new component instance.
|
|
*/
|
|
public function __construct($track) {
|
|
$this->track = $track;
|
|
if (isLegacy()) {
|
|
$path = parse_url($track["image"], PHP_URL_PATH);
|
|
$this->artUrl = "//".request()->getHttpHost()."/proxy/lastfm/".basename($path);
|
|
} else {
|
|
$this->artUrl = $track["image"];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get the view / contents that represent the component.
|
|
*/
|
|
public function render(): View|Closure|string {
|
|
return view('components.lastfm-current');
|
|
}
|
|
}
|