Files
2025-07-24 16:18:27 +07:00

46 lines
1.1 KiB
PHP

<?php
namespace App\View\Components\Module;
use App\Repositories\Module\Network\NetworkRepositoryInterface;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class Network extends Component
{
/**
* Create a new component instance.
*/
public function __construct(
public $model = null,
public NetworkRepositoryInterface $networkRepository
)
{
//
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
$networks = null;
if($this->model && (
isset($this->model->ipaddress->module_host_id) ||
isset($this->model->module_host_id)
))
{
$networks = $this->networkRepository->filter(
[
'module_host_id' => $this->model->ipaddress->module_host_id ?? $this->model->module_host_id
],
[],
[],
['id', 'name']
);
}
return view('components.module.network',compact('networks'));
}
}