diff --git a/app/Http/Controllers/Users/UserFilesController.php b/app/Http/Controllers/Users/UserFilesController.php index f5a3ea1180ad8b07ec8efbe32a9b824cf7cdd090..61a195012a719b13436fc69bdb404d66f3901abd 100644 --- a/app/Http/Controllers/Users/UserFilesController.php +++ b/app/Http/Controllers/Users/UserFilesController.php @@ -33,6 +33,10 @@ class UserFilesController extends Controller $logActions = []; $files = $request->file('file'); + + if (is_null($files)){ + return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles')); + } foreach($files as $file) { $extension = $file->getClientOriginalExtension(); $filename = 'user-' . $user->id . '-' . str_random(8); diff --git a/database/migrations/2021_06_07_155421_add_serial_number_indexes.php b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php new file mode 100644 index 0000000000000000000000000000000000000000..3673489c7e5c1646a0e8d1443ff66179610f9f98 --- /dev/null +++ b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class AddSerialNumberIndexes extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('assets', function (Blueprint $table) { + $table->index(['serial']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('assets', function (Blueprint $table) { + $table->dropIndex(['serial']); + }); + } +} diff --git a/database/migrations/2021_06_07_155436_add_company_id_indexes.php b/database/migrations/2021_06_07_155436_add_company_id_indexes.php new file mode 100644 index 0000000000000000000000000000000000000000..f4a83800cdd30935ee9074b6c217a953ec998796 --- /dev/null +++ b/database/migrations/2021_06_07_155436_add_company_id_indexes.php @@ -0,0 +1,88 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class AddCompanyIdIndexes extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('accessories', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('action_logs', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('assets', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('components', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('consumables', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('departments', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('licenses', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('users', function (Blueprint $table) { + $table->index(['company_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('licenses', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('departments', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('consumables', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('components', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('assets', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('action_logs', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('accessories', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + } +} diff --git a/resources/views/modals/upload-file.blade.php b/resources/views/modals/upload-file.blade.php index a5ee373cbb1b1990c003942cb0a2faf1c0346424..f2910967b9da7a566bb7cdf7562f3b8c1ef6609b 100644 --- a/resources/views/modals/upload-file.blade.php +++ b/resources/views/modals/upload-file.blade.php @@ -19,7 +19,7 @@ <label class="btn btn-default"> {{ trans('button.select_file') }} - <input type="file" name="file[]" multiple="true" class="js-uploadFile" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/*,.csv,.zip,.rar,.doc,.docx,.xls,.xlsx,.xml,.lic,.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/plain,.pdf,application/rtf" style="display:none"> + <input type="file" name="file[]" multiple="true" class="js-uploadFile" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/*,.csv,.zip,.rar,.doc,.docx,.xls,.xlsx,.xml,.lic,.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/plain,.pdf,application/rtf" style="display:none" required> </label> </div>