My goal is to create a model, function(s), so I can reuse them throughout my application. I started by creating a model
Network.php
<?php
namespace App;
class Network extends Model {
public function scopeVCPE($attr){
$vcpes_get = shell_exec('curl http://ift.tt/1LXh9TW');
$vcpes_raw = json_decode($vcpes_get,true);
$vcpes_array = $vcpes_raw['data'][0];
// "cpe_mac": "1234567890",
// "max_up": 300000,
// "max_down": 500000,
// "filter_icmp_inbound": true,
// "dmz_enabled": false,
// "dmz_host": "http:\/\/ddd.com",
// "vlan_id": 2,
// "dns": ["8.8.8.8", "4.2.2.1"],
// "xdns_mode": 0,
// "cfprofileid": 11111,
// "stub_response": "",
// "acl_mode": 1,
// "portal_url": "http:\/\/portal.com",
// "cpe_max_up": 1000000,
// "cpe_max_down": 2000000,
// "cpe_guaranty_up": 300000,
// "cpe_guaranty_down": 400000,
// "account_id": 1234,
// "location_id": 3333,
// "network_count": 3,
// "group_name": "test_group",
// "vse_id": 20,
// "firewall_enabled": false
return $vcpes_array[$attr];
}
}
On top of my controller, I include that model use App\Network;
Use it
Network::scopeVCPE('cpe_mac');
I tried dd(Network::scopeVCPE('cpe_mac'))
I was hoping to get this result of my cpe_mac : 1234567890
Result
Class 'App\Network' not found
I am a little stuck now. Any helps on this will be much appreciated.
Am I forgot to do anything ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire