modified how items are found in the database and how this is processed.
This commit is contained in:
@@ -202,8 +202,8 @@ class AdminController extends Controller
|
|||||||
$found = AllowedLogin::where([
|
$found = AllowedLogin::where([
|
||||||
'entity_type' => $request->allowedentityType,
|
'entity_type' => $request->allowedentityType,
|
||||||
'entity_name' => $request->allowedEntityName,
|
'entity_name' => $request->allowedEntityName,
|
||||||
])->get();
|
])->count();
|
||||||
if($found != null) {
|
if($found != 0) {
|
||||||
AllowedLogin::where([
|
AllowedLogin::where([
|
||||||
'entity_type' => $request->allowedEntityType,
|
'entity_type' => $request->allowedEntityType,
|
||||||
'entity_name' => $request->allowedEntityName,
|
'entity_name' => $request->allowedEntityName,
|
||||||
|
|||||||
@@ -369,9 +369,9 @@ class MoonsAdminController extends Controller
|
|||||||
'Planet' => $request->planet,
|
'Planet' => $request->planet,
|
||||||
'Moon' => $request->moon,
|
'Moon' => $request->moon,
|
||||||
'Contact' => $contact,
|
'Contact' => $contact,
|
||||||
])->first();
|
])->count();
|
||||||
|
|
||||||
if($found) {
|
if($found != 0) {
|
||||||
MoonRental::where([
|
MoonRental::where([
|
||||||
'System' => $request->system,
|
'System' => $request->system,
|
||||||
'Planet' => $request->planet,
|
'Planet' => $request->planet,
|
||||||
|
|||||||
@@ -101,10 +101,10 @@ class ProcessAssetsJob implements ShouldQueue
|
|||||||
foreach($assets as $asset) {
|
foreach($assets as $asset) {
|
||||||
$found = Asset::where([
|
$found = Asset::where([
|
||||||
'item_id' => $asset['item_id'],
|
'item_id' => $asset['item_id'],
|
||||||
])->get();
|
])->count();
|
||||||
|
|
||||||
//Update the asset if we found it, otherwise add the asset to the database
|
//Update the asset if we found it, otherwise add the asset to the database
|
||||||
if(!$found) {
|
if($found == 0) {
|
||||||
if(in_array($asset['location_flag'], $this->location_array)) {
|
if(in_array($asset['location_flag'], $this->location_array)) {
|
||||||
$this->StoreNewAsset($asset);
|
$this->StoreNewAsset($asset);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class StructureStockHelper {
|
|||||||
|
|
||||||
foreach($newAssets as $asset) {
|
foreach($newAssets as $asset) {
|
||||||
//See if the asset is in the asset table already.
|
//See if the asset is in the asset table already.
|
||||||
$found = Asset::where(['item_id' => $asset['item_id']]);
|
$found = Asset::where(['item_id' => $asset['item_id']])->count();
|
||||||
if(!$found) {
|
if($found == 0) {
|
||||||
$newItem = new Asset;
|
$newItem = new Asset;
|
||||||
if(isset($asset['is_blueprint_copy'])) {
|
if(isset($asset['is_blueprint_copy'])) {
|
||||||
$newItem->is_blueprint_coopy = $asset['is_blueprint_copy'];
|
$newItem->is_blueprint_coopy = $asset['is_blueprint_copy'];
|
||||||
|
|||||||
Reference in New Issue
Block a user