Update source into github
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Module;
|
||||
|
||||
use App\Repositories\Module\Datacenter\DatacenterRepositoryInterface;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Datacenter extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public $model = null,
|
||||
public DatacenterRepositoryInterface $datacenterRepository
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
$vcenterId = $this->model?->vCenter?->id;
|
||||
|
||||
$datacenters = null;
|
||||
|
||||
if ($vcenterId) {
|
||||
$datacenters = $this->datacenterRepository->filter(
|
||||
['vcenter_id' => $vcenterId],
|
||||
[],
|
||||
[],
|
||||
['id', 'name']
|
||||
);
|
||||
}
|
||||
|
||||
return view('components.module.datacenter', compact('datacenters'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user