Skip to content

Commit

Permalink
small fixes #392
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jun 23, 2018
1 parent 912f085 commit 9566464
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
4 changes: 1 addition & 3 deletions app/Http/Controllers/Expenses/Bills.php
Expand Up @@ -298,9 +298,7 @@ public function import(ImportFile $import)
$import->each(function ($sheet) use (&$success) {
$slug = 'Expense\\' . str_singular(studly_case($sheet->getTitle()));

$success = Import::createFromSheet($sheet, $slug);

if (!$success) {
if (!$success = Import::createFromSheet($sheet, $slug)) {
return false;
}
});
Expand Down
4 changes: 1 addition & 3 deletions app/Http/Controllers/Incomes/Invoices.php
Expand Up @@ -319,9 +319,7 @@ public function import(ImportFile $import)
$import->each(function ($sheet) use (&$success) {
$slug = 'Income\\' . str_singular(studly_case($sheet->getTitle()));

$success = Import::createFromSheet($sheet, $slug);

if (!$success) {
if (!$success = Import::createFromSheet($sheet, $slug)) {
return false;
}
});
Expand Down
14 changes: 1 addition & 13 deletions app/Utilities/Import.php
Expand Up @@ -13,21 +13,9 @@ public static function createFromFile($import, $slug)

// Loop through all sheets
$import->each(function ($sheet) use (&$success, $slug) {
$model = '\App\Models\\' . $slug;
$request = '\App\Http\Requests\\' . $slug;

if (!class_exists($model) || !class_exists($request)) {
return false;
}

$tmp = explode('\\', $slug);
$file_name = str_plural(strtolower($tmp[1]));

if ($sheet->getTitle() != $file_name) {
if (!$success = static::createFromSheet($sheet, $slug)) {
return false;
}

$success = static::createFromSheet($sheet, $slug);
});

return $success;
Expand Down

0 comments on commit 9566464

Please sign in to comment.