@@ -39,7 +39,7 @@ |
||
39 | 39 | 'location' => 'required|string|max:255', |
40 | 40 | ]); |
41 | 41 | |
42 | - $supplier = Supplier::create($request->only(['name', 'location'])); |
|
42 | + $supplier = Supplier::create($request->only([ 'name', 'location' ])); |
|
43 | 43 | event(new SupplierWasCreated($supplier)); |
44 | 44 | } |
45 | 45 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $purchase = Purchase::findOrFail($id); |
41 | 41 | |
42 | 42 | return fractal()->item($purchase, new PurchaseTransformer) |
43 | - ->parseIncludes(['guitars', 'supplier']) |
|
43 | + ->parseIncludes([ 'guitars', 'supplier' ]) |
|
44 | 44 | ->toArray(); |
45 | 45 | } |
46 | 46 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | */ |
14 | 14 | public function broadcastOn() |
15 | 15 | { |
16 | - return ['default']; |
|
16 | + return [ 'default' ]; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function broadcastWith() |
20 | 20 | { |
21 | - return []; |
|
21 | + return [ ]; |
|
22 | 22 | } |
23 | 23 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -Route::group(['middleware' => 'web'], function ($router) { |
|
4 | - $router->get('/', function () { |
|
3 | +Route::group([ 'middleware' => 'web' ], function($router) { |
|
4 | + $router->get('/', function() { |
|
5 | 5 | return redirect('/dashboard'); |
6 | 6 | }); |
7 | 7 | |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | $router->put('api/notifications/{id}/dismiss', 'API\NotificationController@dismiss'); |
36 | 36 | $router->get('api/users/me', 'API\UserController@getCurrentUser'); |
37 | 37 | |
38 | - $router->resource('makes', 'MakeController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
39 | - $router->resource('models', 'ModelController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
40 | - $router->resource('purchases', 'PurchaseController', ['except' => ['create', 'edit', 'update']]); |
|
38 | + $router->resource('makes', 'MakeController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
39 | + $router->resource('models', 'ModelController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
40 | + $router->resource('purchases', 'PurchaseController', [ 'except' => [ 'create', 'edit', 'update' ] ]); |
|
41 | 41 | $router->post('purchases/{id}/guitars', 'GuitarController@store'); |
42 | - $router->resource('suppliers', 'SupplierController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
43 | - $router->resource('warehouses', 'WarehouseController', ['except' => ['create', 'show', 'edit']]); |
|
44 | - $router->resource('guitars', 'GuitarController', ['only' => ['index', 'update', 'destroy']]); |
|
42 | + $router->resource('suppliers', 'SupplierController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
43 | + $router->resource('warehouses', 'WarehouseController', [ 'except' => [ 'create', 'show', 'edit' ] ]); |
|
44 | + $router->resource('guitars', 'GuitarController', [ 'only' => [ 'index', 'update', 'destroy' ] ]); |
|
45 | 45 | $router->get('guitars/{id}/sale', 'GuitarController@showSaleFor'); |
46 | 46 | $router->post('guitars/{id}/sale', 'GuitarController@sale'); |
47 | 47 | }); |
@@ -13,33 +13,33 @@ |
||
13 | 13 | * @var array |
14 | 14 | */ |
15 | 15 | protected $listen = [ |
16 | - 'App\Events\MakeWasCreated' => [], |
|
17 | - 'App\Events\MakeWasDeleted' => [], |
|
16 | + 'App\Events\MakeWasCreated' => [ ], |
|
17 | + 'App\Events\MakeWasDeleted' => [ ], |
|
18 | 18 | |
19 | - 'App\Events\ModelWasCreated' => [], |
|
20 | - 'App\Events\ModelWasDeleted' => [], |
|
19 | + 'App\Events\ModelWasCreated' => [ ], |
|
20 | + 'App\Events\ModelWasDeleted' => [ ], |
|
21 | 21 | |
22 | - 'App\Events\WarehouseWasCreated' => [], |
|
23 | - 'App\Events\WarehouseWasUpdated' => [], |
|
24 | - 'App\Events\WarehouseWasDeleted' => [], |
|
22 | + 'App\Events\WarehouseWasCreated' => [ ], |
|
23 | + 'App\Events\WarehouseWasUpdated' => [ ], |
|
24 | + 'App\Events\WarehouseWasDeleted' => [ ], |
|
25 | 25 | |
26 | - 'App\Events\SupplierWasCreated' => [], |
|
27 | - 'App\Events\SupplierWasDeleted' => [], |
|
26 | + 'App\Events\SupplierWasCreated' => [ ], |
|
27 | + 'App\Events\SupplierWasDeleted' => [ ], |
|
28 | 28 | |
29 | 29 | 'App\Events\PurchaseWasCreated' => [ |
30 | 30 | 'App\Listeners\GeneratePurchaseNotification', |
31 | 31 | ], |
32 | - 'App\Events\PurchaseWasDeleted' => [], |
|
32 | + 'App\Events\PurchaseWasDeleted' => [ ], |
|
33 | 33 | |
34 | - 'App\Events\GuitarWasCreated' => [], |
|
35 | - 'App\Events\GuitarWasUpdated' => [], |
|
36 | - 'App\Events\GuitarWasDeleted' => [], |
|
34 | + 'App\Events\GuitarWasCreated' => [ ], |
|
35 | + 'App\Events\GuitarWasUpdated' => [ ], |
|
36 | + 'App\Events\GuitarWasDeleted' => [ ], |
|
37 | 37 | |
38 | - 'App\Events\SaleWasCreated' => [], |
|
39 | - 'App\Events\SaleWasDeleted' => [], |
|
38 | + 'App\Events\SaleWasCreated' => [ ], |
|
39 | + 'App\Events\SaleWasDeleted' => [ ], |
|
40 | 40 | |
41 | - 'App\Events\NotificationWasCreated' => [], |
|
42 | - 'App\Events\NotificationWasDismissed' => [], |
|
41 | + 'App\Events\NotificationWasCreated' => [ ], |
|
42 | + 'App\Events\NotificationWasDismissed' => [ ], |
|
43 | 43 | ]; |
44 | 44 | |
45 | 45 | /** |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('fractal')) { |
|
3 | +if (!function_exists('fractal')) { |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * @return \Spatie\Fractal\Fractal |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | 'racks.*.capacity' => 'required|integer|min:1', |
43 | 43 | ]); |
44 | 44 | |
45 | - $warehouse = Warehouse::create($request->only(['name'])); |
|
46 | - $racks = $request->input('racks', []); |
|
45 | + $warehouse = Warehouse::create($request->only([ 'name' ])); |
|
46 | + $racks = $request->input('racks', [ ]); |
|
47 | 47 | $warehouse->addRacks($racks); |
48 | 48 | event(new WarehouseWasCreated($warehouse)); |
49 | 49 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | ]); |
66 | 66 | |
67 | 67 | $warehouse = Warehouse::findOrFail($id); |
68 | - $warehouse->update($request->only(['name'])); |
|
68 | + $warehouse->update($request->only([ 'name' ])); |
|
69 | 69 | |
70 | - $racks = $request->input('racks', []); |
|
70 | + $racks = $request->input('racks', [ ]); |
|
71 | 71 | $warehouse->removeRacksNotIn($this->getIdsFrom($racks)); |
72 | 72 | $warehouse->addOrUpdateRacks($racks); |
73 | 73 | event(new WarehouseWasUpdated($warehouse)); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | public function store($id, Request $request) |
45 | 45 | { |
46 | 46 | $purchase = Purchase::findOrFail($id); |
47 | - if (! $purchase->hasArrived() || ! $purchase->isPendingStorage()) { |
|
48 | - return response(['purchase' => ['The purchase has not yet arrived or doesn\'t require addition of guitars.']], |
|
47 | + if (!$purchase->hasArrived() || !$purchase->isPendingStorage()) { |
|
48 | + return response([ 'purchase' => [ 'The purchase has not yet arrived or doesn\'t require addition of guitars.' ] ], |
|
49 | 49 | 422); |
50 | 50 | } |
51 | 51 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | |
61 | 61 | $rack = Rack::find($request->input('rack_id')); |
62 | 62 | if ($rack->used >= $rack->capacity) { |
63 | - return response(['rack_id' => ['The selected rack is full.']], 422); |
|
63 | + return response([ 'rack_id' => [ 'The selected rack is full.' ] ], 422); |
|
64 | 64 | } |
65 | 65 | |
66 | - $guitar = Guitar::create($request->only(['rack_id', 'model_id', 'colour', 'price']) + [ |
|
66 | + $guitar = Guitar::create($request->only([ 'rack_id', 'model_id', 'colour', 'price' ]) + [ |
|
67 | 67 | 'make_id' => $purchase->make_id, |
68 | 68 | 'purchase_id' => $purchase->id, |
69 | 69 | 'damaged' => $request->input('damaged'), |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | $rack = Rack::find($request->input('rack_id')); |
97 | 97 | if ($rack->used >= $rack->capacity) { |
98 | - return response(['rack_id' => ['The selected rack is full.']], 422); |
|
98 | + return response([ 'rack_id' => [ 'The selected rack is full.' ] ], 422); |
|
99 | 99 | } |
100 | 100 | |
101 | - $guitar->update($request->only(['rack_id', 'model_id', 'colour', 'price']) + [ |
|
101 | + $guitar->update($request->only([ 'rack_id', 'model_id', 'colour', 'price' ]) + [ |
|
102 | 102 | 'damaged' => $request->input('damaged'), |
103 | 103 | 'condition' => $request->input('damaged') ? $request->input('condition') : null, |
104 | 104 | ]); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $guitar = Guitar::findOrFail($id); |
119 | 119 | |
120 | 120 | if ($guitar->isSold()) { |
121 | - return response(['guitar_id' => ['This guitar has already been sold.']], 422); |
|
121 | + return response([ 'guitar_id' => [ 'This guitar has already been sold.' ] ], 422); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $this->validate($request, [ |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | |
130 | 130 | $shop = null; |
131 | 131 | if ($request->input('customer_type') == 'shop') { |
132 | - $shop = Shop::create($request->only(['name', 'address']))->id; |
|
132 | + $shop = Shop::create($request->only([ 'name', 'address' ]))->id; |
|
133 | 133 | } |
134 | 134 | |
135 | - $sale = Sale::create($request->only(['name', 'address']) + ['guitar_id' => $id, 'shop_id' => $shop]); |
|
135 | + $sale = Sale::create($request->only([ 'name', 'address' ]) + [ 'guitar_id' => $id, 'shop_id' => $shop ]); |
|
136 | 136 | |
137 | 137 | event(new SaleWasCreated($sale)); |
138 | 138 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $model = Model::create($request->only([ |
47 | 47 | 'name', |
48 | 48 | 'make_id', |
49 | - ]) + ['photo' => config('shop.images.dir').$fileName]); |
|
49 | + ]) + [ 'photo' => config('shop.images.dir').$fileName ]); |
|
50 | 50 | event(new ModelWasCreated($model)); |
51 | 51 | } |
52 | 52 |