Updated models and controllers to use first()
Updated models and controllers to use first() rather than get() with [0]
This commit is contained in:
parent
8221bf45d8
commit
df779ba633
|
@ -22,7 +22,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
public function show(Domains $domain)
|
public function show(Domains $domain)
|
||||||
{//Need to modern
|
{//Need to modern
|
||||||
$domain_info = Domains::domain($domain->id)[0];
|
$domain_info = Domains::domain($domain->id);
|
||||||
return view('domains.show', compact(['domain_info']));
|
return view('domains.show', compact(['domain_info']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
public function edit(Domains $domain)
|
public function edit(Domains $domain)
|
||||||
{
|
{
|
||||||
$domain_info = Domains::domain($domain->id)[0];
|
$domain_info = Domains::domain($domain->id);
|
||||||
return view('domains.edit', compact(['domain_info']));
|
return view('domains.edit', compact(['domain_info']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class MiscController extends Controller
|
||||||
|
|
||||||
public function show(Misc $misc)
|
public function show(Misc $misc)
|
||||||
{
|
{
|
||||||
$misc_data = Misc::misc($misc->id)[0];
|
$misc_data = Misc::misc($misc->id);
|
||||||
return view('misc.show', compact(['misc_data']));
|
return view('misc.show', compact(['misc_data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class MiscController extends Controller
|
||||||
|
|
||||||
public function edit(Misc $misc)
|
public function edit(Misc $misc)
|
||||||
{
|
{
|
||||||
$misc_data = Misc::misc($misc->id)[0];
|
$misc_data = Misc::misc($misc->id);
|
||||||
return view('misc.edit', compact('misc_data'));
|
return view('misc.edit', compact('misc_data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ class ResellerController extends Controller
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'domain' => 'required|min:4',
|
'domain' => 'required|min:4',
|
||||||
'reseller_type' => 'required',
|
'reseller_type' => 'required',
|
||||||
|
@ -94,13 +93,13 @@ class ResellerController extends Controller
|
||||||
|
|
||||||
public function show(Reseller $reseller)
|
public function show(Reseller $reseller)
|
||||||
{
|
{
|
||||||
$reseller = Reseller::resellerHosting($reseller->id)[0];
|
$reseller = Reseller::resellerHosting($reseller->id);
|
||||||
return view('reseller.show', compact(['reseller']));
|
return view('reseller.show', compact(['reseller']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Reseller $reseller)
|
public function edit(Reseller $reseller)
|
||||||
{
|
{
|
||||||
$reseller = Reseller::resellerHosting($reseller->id)[0];
|
$reseller = Reseller::resellerHosting($reseller->id);
|
||||||
return view('reseller.edit', compact(['reseller']));
|
return view('reseller.edit', compact(['reseller']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ class SeedBoxesController extends Controller
|
||||||
|
|
||||||
public function show(SeedBoxes $seedbox)
|
public function show(SeedBoxes $seedbox)
|
||||||
{
|
{
|
||||||
$seedbox_data = SeedBoxes::seedbox($seedbox->id)[0];
|
$seedbox_data = SeedBoxes::seedbox($seedbox->id);
|
||||||
return view('seedboxes.show', compact(['seedbox_data']));
|
return view('seedboxes.show', compact(['seedbox_data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(SeedBoxes $seedbox)
|
public function edit(SeedBoxes $seedbox)
|
||||||
{
|
{
|
||||||
$seedbox_data = SeedBoxes::seedbox($seedbox->id)[0];
|
$seedbox_data = SeedBoxes::seedbox($seedbox->id);
|
||||||
return view('seedboxes.edit', compact(['seedbox_data']));
|
return view('seedboxes.edit', compact(['seedbox_data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,14 +118,14 @@ class ServerController extends Controller
|
||||||
|
|
||||||
public function show(Server $server)
|
public function show(Server $server)
|
||||||
{
|
{
|
||||||
$server_data = Server::server($server->id)[0];
|
$server_data = Server::server($server->id);
|
||||||
|
|
||||||
return view('servers.show', compact(['server_data']));
|
return view('servers.show', compact(['server_data']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Server $server)
|
public function edit(Server $server)
|
||||||
{
|
{
|
||||||
$server_data = Server::server($server->id)[0];
|
$server_data = Server::server($server->id);
|
||||||
|
|
||||||
return view('servers.edit', compact(['server_data']));
|
return view('servers.edit', compact(['server_data']));
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ class SharedController extends Controller
|
||||||
|
|
||||||
public function show(Shared $shared)
|
public function show(Shared $shared)
|
||||||
{
|
{
|
||||||
$shared = Shared::sharedHosting($shared->id)[0];
|
$shared = Shared::sharedHosting($shared->id);
|
||||||
return view('shared.show', compact(['shared']));
|
return view('shared.show', compact(['shared']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Shared $shared)
|
public function edit(Shared $shared)
|
||||||
{
|
{
|
||||||
$shared = Shared::sharedHosting($shared->id)[0];
|
$shared = Shared::sharedHosting($shared->id);
|
||||||
return view('shared.edit', compact(['shared']));
|
return view('shared.edit', compact(['shared']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Domains extends Model
|
||||||
{//Single domains and relationships (no using joins)
|
{//Single domains and relationships (no using joins)
|
||||||
return Cache::remember("domain.$domain_id", now()->addMonth(1), function () use ($domain_id) {
|
return Cache::remember("domain.$domain_id", now()->addMonth(1), function () use ($domain_id) {
|
||||||
return Domains::where('id', $domain_id)
|
return Domains::where('id', $domain_id)
|
||||||
->with(['provider', 'price', 'labels', 'labels.label'])->get();
|
->with(['provider', 'price', 'labels', 'labels.label'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Misc extends Model
|
||||||
{//Single misc and relationships (no using joins)
|
{//Single misc and relationships (no using joins)
|
||||||
return Cache::remember("misc.$misc_id", now()->addMonth(1), function () use ($misc_id) {
|
return Cache::remember("misc.$misc_id", now()->addMonth(1), function () use ($misc_id) {
|
||||||
return Misc::where('id', $misc_id)
|
return Misc::where('id', $misc_id)
|
||||||
->with(['price'])->get();
|
->with(['price'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Reseller extends Model
|
||||||
{//Single reseller hosting and relationships (no using joins)
|
{//Single reseller hosting and relationships (no using joins)
|
||||||
return Cache::remember("reseller_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) {
|
return Cache::remember("reseller_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) {
|
||||||
return Reseller::where('id', $shared_id)
|
return Reseller::where('id', $shared_id)
|
||||||
->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get();
|
->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class SeedBoxes extends Model
|
||||||
{//Single seedbox and relationships (no using joins)
|
{//Single seedbox and relationships (no using joins)
|
||||||
return Cache::remember("seedbox.$seedbox_id", now()->addMonth(1), function () use ($seedbox_id) {
|
return Cache::remember("seedbox.$seedbox_id", now()->addMonth(1), function () use ($seedbox_id) {
|
||||||
return SeedBoxes::where('id', $seedbox_id)
|
return SeedBoxes::where('id', $seedbox_id)
|
||||||
->with(['location', 'provider', 'price', 'labels.label'])->get();
|
->with(['location', 'provider', 'price', 'labels.label'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Server extends Model
|
||||||
{//Single server and relationships (no using joins)
|
{//Single server and relationships (no using joins)
|
||||||
return Cache::remember("server.$server_id", now()->addMonth(1), function () use ($server_id) {
|
return Cache::remember("server.$server_id", now()->addMonth(1), function () use ($server_id) {
|
||||||
return Server::where('id', $server_id)
|
return Server::where('id', $server_id)
|
||||||
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->get();
|
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Shared extends Model
|
||||||
{//Single shared hosting and relationships (no using joins)
|
{//Single shared hosting and relationships (no using joins)
|
||||||
return Cache::remember("shared_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) {
|
return Cache::remember("shared_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) {
|
||||||
return Shared::where('id', $shared_id)
|
return Shared::where('id', $shared_id)
|
||||||
->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get();
|
->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user