@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function register() |
| 22 | 22 | { |
| 23 | - include __DIR__.'/routes.php'; |
|
| 23 | + include __DIR__ . '/routes.php'; |
|
| 24 | 24 | $this->app->make('Scool\Inventory\InventoryController'); |
| 25 | 25 | if (!defined('SCOOL_INVENTORY_PATH')) { |
| 26 | - define('SCOOL_INVENTORY_PATH', realpath(__DIR__.'/../../')); |
|
| 26 | + define('SCOOL_INVENTORY_PATH', realpath(__DIR__ . '/../../')); |
|
| 27 | 27 | } |
| 28 | 28 | $this->registerNamesServiceProvider(); |
| 29 | 29 | $this->registerStatefulEloquentServiceProvider(); |
| 30 | 30 | $this->bindRepositories(); |
| 31 | - $this->app->bind(StatsRepositoryInterface::class, function () { |
|
| 31 | + $this->app->bind(StatsRepositoryInterface::class, function() { |
|
| 32 | 32 | return new CacheableStatsRepository(new StatsRepository()); |
| 33 | 33 | }); |
| 34 | 34 | } |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | if (!$this->app->routesAreCached()) { |
| 86 | 86 | $router = app('router'); |
| 87 | - $router->group(['namespace' => 'Scool\Inventory\Http\Controllers'], function () { |
|
| 88 | - require __DIR__.'/../Http/routes.php'; |
|
| 87 | + $router->group([ 'namespace' => 'Scool\Inventory\Http\Controllers' ], function() { |
|
| 88 | + require __DIR__ . '/../Http/routes.php'; |
|
| 89 | 89 | }); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | private function loadViews() |
| 97 | 97 | { |
| 98 | - $this->loadViewsFrom(SCOOL_INVENTORY_PATH.'/resources/views', 'inventory'); |
|
| 98 | + $this->loadViewsFrom(SCOOL_INVENTORY_PATH . '/resources/views', 'inventory'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | private function loadMigrations() |
| 105 | 105 | { |
| 106 | - $this->loadMigrationsFrom(SCOOL_INVENTORY_PATH.'/database/migrations'); |
|
| 106 | + $this->loadMigrationsFrom(SCOOL_INVENTORY_PATH . '/database/migrations'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ScoolInventory::configs(), 'scool_inventory' |
| 126 | 126 | ); |
| 127 | 127 | $this->mergeConfigFrom( |
| 128 | - SCOOL_INVENTORY_PATH.'/config/inventory.php', 'scool_inventory' |
|
| 128 | + SCOOL_INVENTORY_PATH . '/config/inventory.php', 'scool_inventory' |
|
| 129 | 129 | ); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | private function publishTests() |
| 136 | 136 | { |
| 137 | 137 | $this->publishes( |
| 138 | - [SCOOL_INVENTORY_PATH.'/tests/InventoryTest.php' => 'tests/InventoryTest.php'], |
|
| 138 | + [ SCOOL_INVENTORY_PATH . '/tests/InventoryTest.php' => 'tests/InventoryTest.php' ], |
|
| 139 | 139 | 'scool_inventory' |
| 140 | 140 | ); |
| 141 | 141 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'moneySource.name as moneySource_name', 'moneySource.id as moneySourceId', 'provider.name as provider_name', 'provider.id as provider_id') |
| 45 | 45 | ->paginate(5); |
| 46 | 46 | |
| 47 | - return view('inventory/index', ['inventories' => $inventories]); |
|
| 47 | + return view('inventory/index', [ 'inventories' => $inventories ]); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $locations = Location::all(); |
| 62 | 62 | $providers = Provider::all(); |
| 63 | 63 | |
| 64 | - return view('inventory/create', ['material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
| 64 | + return view('inventory/create', [ 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
| 65 | 65 | 'moneySources' => $moneySources, 'locations' => $locations, 'providers' => $providers, ]); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | $this->validateInput($request); |
| 78 | 78 | // Upload image |
| 79 | 79 | $path = $request->file('picture')->store('avatars'); |
| 80 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
| 80 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', 'price', |
|
| 81 | 81 | 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
| 82 | 82 | $input = $this->createQueryInput($keys, $request); |
| 83 | - $input['picture'] = $path; |
|
| 83 | + $input[ 'picture' ] = $path; |
|
| 84 | 84 | |
| 85 | 85 | Inventory::create($input); |
| 86 | 86 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $locations = Location::all(); |
| 122 | 122 | $providers = Provider::all(); |
| 123 | 123 | |
| 124 | - return view('inventory/edit', ['inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
| 124 | + return view('inventory/edit', [ 'inventory' => $inventory, 'material_types' => $material_types, 'brands' => $brands, 'brand_models' => $brand_models, |
|
| 125 | 125 | 'moneySources' => $moneySources, 'locations'=> $locations, 'providers' => $providers, ]); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | $inventory = Inventory::findOrFail($id); |
| 139 | 139 | $this->validateInput($request); |
| 140 | 140 | // Upload image |
| 141 | - $keys = ['name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
| 141 | + $keys = [ 'name', 'description', 'material_type_id', 'brand_id', 'model_id', 'location_id', 'quantity', |
|
| 142 | 142 | 'price', 'moneysourceId', 'provider_id', 'date_entrance', 'last_update', ]; |
| 143 | 143 | $input = $this->createQueryInput($keys, $request); |
| 144 | 144 | if ($request->file('picture')) { |
| 145 | 145 | $path = $request->file('picture')->store('public'); |
| 146 | - $input['picture'] = $path; |
|
| 146 | + $input[ 'picture' ] = $path; |
|
| 147 | 147 | } |
| 148 | 148 | Inventory::where('id', $id) |
| 149 | 149 | ->update($input); |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | public function search(Request $request) |
| 176 | 176 | { |
| 177 | 177 | $constraints = [ |
| 178 | - 'name' => $request['name'], |
|
| 178 | + 'name' => $request[ 'name' ], |
|
| 179 | 179 | ]; |
| 180 | 180 | $inventories = $this->doSearchingQuery($constraints); |
| 181 | 181 | |
| 182 | - return view('inventory/index', ['inventories' => $inventories, 'searchingVals' => $constraints]); |
|
| 182 | + return view('inventory/index', [ 'inventories' => $inventories, 'searchingVals' => $constraints ]); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | private function doSearchingQuery($constraints) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $index = 0; |
| 190 | 190 | foreach ($constraints as $constraint) { |
| 191 | 191 | if ($constraint != null) { |
| 192 | - $query = $query->where($fields[$index], 'like', '%'.$constraint.'%'); |
|
| 192 | + $query = $query->where($fields[ $index ], 'like', '%' . $constraint . '%'); |
|
| 193 | 193 | } |
| 194 | 194 | $index++; |
| 195 | 195 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function load($name) |
| 208 | 208 | { |
| 209 | - $path = storage_path().'/app/public/'.$name; |
|
| 209 | + $path = storage_path() . '/app/public/' . $name; |
|
| 210 | 210 | if (file_exists($path)) { |
| 211 | 211 | return Response::download($path); |
| 212 | 212 | } |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | private function createQueryInput($keys, $request) |
| 235 | 235 | { |
| 236 | - $queryInput = []; |
|
| 236 | + $queryInput = [ ]; |
|
| 237 | 237 | for ($i = 0; $i < count($keys); $i++) { |
| 238 | - $key = $keys[$i]; |
|
| 239 | - $queryInput[$key] = $request[$key]; |
|
| 238 | + $key = $keys[ $i ]; |
|
| 239 | + $queryInput[ $key ] = $request[ $key ]; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | return $queryInput; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('inventories', function (Blueprint $table) { |
|
| 16 | + Schema::create('inventories', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('public_id'); |
| 19 | 19 | $table->string('name', 80); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $table->softDeletes(); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - Schema::table('inventories', function ($table) { |
|
| 36 | + Schema::table('inventories', function($table) { |
|
| 37 | 37 | $table->foreign('material_type_id')->references('id')->on('material_type')->onDelete('cascade'); |
| 38 | 38 | $table->foreign('brand_id')->references('id')->on('brand')->onDelete('cascade'); |
| 39 | 39 | $table->foreign('model_id')->references('id')->on('brand_model')->onDelete('cascade'); |