app/Jobs/ImportProfession.php: should not use firstOrFail() when searching for items. as this will do an abort(404), that is very confusing.
This commit is contained in:
parent
329c753105
commit
8e887d1ebe
1 changed files with 8 additions and 2 deletions
|
|
@ -79,7 +79,10 @@ class ImportProfession implements ShouldQueue
|
|||
// Create recipes for character
|
||||
foreach($this->recipes as $data) {
|
||||
|
||||
$item = Item::where('name', $data->name)->firstOrFail();
|
||||
$item = Item::where('name', $data->name)->first();
|
||||
if (!$item) {
|
||||
throw new Exception("Could not find item '{$data->name}'");
|
||||
}
|
||||
|
||||
$recipes[] = $this->getRecipe($item, $profession, $data)->id;
|
||||
}
|
||||
|
|
@ -129,7 +132,10 @@ class ImportProfession implements ShouldQueue
|
|||
|
||||
// Reagents
|
||||
foreach($data->items as $reagent) {
|
||||
$item = Item::where('name', $reagent->name)->firstOrFail();
|
||||
$item = Item::where('name', $reagent->name)->first();
|
||||
if (!$item) {
|
||||
throw new Exception("Could not find item '{$reagent->name}'");
|
||||
}
|
||||
$recipe->reagents()->attach($item, [ 'quantity' => $reagent->num ]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue