I have a function in my controller. I create variables, and send them to my view via compact function one by one.
public function edit($id,$cpe_mac) {
$vcpe = VSE::vcpe($cpe_mac);
$vcpe = json_decode (json_encode($vcpe), FALSE);
$cpe = VSE::cpe($cpe_mac);
$wan = $cpe['wan'];
$acl = $cpe['acl'];
$guest = $cpe['vlan'][0];
$private = $cpe['vlan'][1];
$cpe_name = VSE::cpe_name($cpe_mac)['cpe_name'];
$p_max_up = $private['bandwidth']['max_up'];
$p_max_down = $private['bandwidth']['max_down'];
$p_ip = $private['lan']['ip_address'];
$p_netmask = $private['lan']['netmask'];
$p_max_clients = $private['lan']['dhcp_server']['max_clients'];
$p_dns = $private['lan']['dhcp_server']['dns'][0];
$p_dns2 = $private['lan']['dhcp_server']['dns'][1];
$cpe = json_decode (json_encode($cpe), FALSE);
return view('cpe.edit', compact(['vcpe','cpe_mac','cpe_name','cpe','wan','acl','private','guest',
'p_max_up','p_max_down','p_ip','p_netmask','p_max_clients','p_dns','p_dns2'
]));
}
Question
Is there a way to send all the variables that in my edit function to the view rather than doing it one by one ?
Is it possible to do this in PHP ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire