@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $this->validate($request, $this->rules($request->input('supplier_id'))); |
| 40 | 40 | $purchase = $this->getSupplier($request)->makePurchase( |
| 41 | - $request->only(['id', 'make_id', 'quantity', 'price', 'date_purchased', 'delivery_date']) |
|
| 41 | + $request->only([ 'id', 'make_id', 'quantity', 'price', 'date_purchased', 'delivery_date' ]) |
|
| 42 | 42 | ); |
| 43 | 43 | event(new PurchaseWasCreated($purchase)); |
| 44 | 44 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'supplier.location' => 'required_if:supplier_id,new|string|max:255' |
| 76 | 76 | ]; |
| 77 | 77 | if ($supplierId != 'new') { |
| 78 | - $rules += ['supplier_id' => 'required|integer|exists:suppliers,id']; |
|
| 78 | + $rules += [ 'supplier_id' => 'required|integer|exists:suppliers,id' ]; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | return $rules; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | 'name' => 'required|string|max:255' |
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | - $make = Make::create($request->only(['name'])); |
|
| 41 | + $make = Make::create($request->only([ 'name' ])); |
|
| 42 | 42 | event(new MakeWasCreated($make)); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -41,12 +41,12 @@ |
||
| 41 | 41 | 'photo' => 'required|image', |
| 42 | 42 | ]); |
| 43 | 43 | $photo = $request->file('photo'); |
| 44 | - $fileName = sha1(time() . $photo->getClientOriginalName()) . '.' . $photo->getClientOriginalExtension(); |
|
| 44 | + $fileName = sha1(time().$photo->getClientOriginalName()).'.'.$photo->getClientOriginalExtension(); |
|
| 45 | 45 | $photo->move(config('shop.images.path'), $fileName); |
| 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 | |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | - protected $guarded = []; |
|
| 14 | + protected $guarded = [ ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
@@ -47,6 +47,6 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function dismiss() |
| 49 | 49 | { |
| 50 | - return $this->update(['dismissed' => true]); |
|
| 50 | + return $this->update([ 'dismissed' => true ]); |
|
| 51 | 51 | } |
| 52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @param Guitar $guitar |
| 58 | 58 | * |
| 59 | - * @return \League\Fractal\Resource\Collection |
|
| 59 | + * @return \League\Fractal\Resource\Item |
|
| 60 | 60 | */ |
| 61 | 61 | public function includePurchase(Guitar $guitar) |
| 62 | 62 | { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param Guitar $guitar |
| 70 | 70 | * |
| 71 | - * @return \League\Fractal\Resource\Collection |
|
| 71 | + * @return \League\Fractal\Resource\Item |
|
| 72 | 72 | */ |
| 73 | 73 | public function includeSale(Guitar $guitar) |
| 74 | 74 | { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - protected $availableIncludes = ['purchase', 'sale']; |
|
| 15 | + protected $availableIncludes = [ 'purchase', 'sale' ]; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Turn this item object into a generic array. |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | 'capacity' => $guitar->rack->capacity, |
| 45 | 45 | ], |
| 46 | 46 | 'colour' => $guitar->colour, |
| 47 | - 'price' => (float)$guitar->price, |
|
| 48 | - 'damaged' => (bool)$guitar->damaged, |
|
| 47 | + 'price' => (float) $guitar->price, |
|
| 48 | + 'damaged' => (bool) $guitar->damaged, |
|
| 49 | 49 | 'condition' => $guitar->condition, |
| 50 | - 'sold' => (bool)$guitar->isSold(), |
|
| 50 | + 'sold' => (bool) $guitar->isSold(), |
|
| 51 | 51 | ]; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -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 | |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | $router->put('api/notifications/{id}/dismiss', 'API\NotificationController@dismiss'); |
| 35 | 35 | $router->get('api/users/me', 'API\UserController@getCurrentUser'); |
| 36 | 36 | |
| 37 | - $router->resource('makes', 'MakeController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
| 38 | - $router->resource('models', 'ModelController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
| 39 | - $router->resource('purchases', 'PurchaseController', ['except' => ['create', 'edit', 'update']]); |
|
| 37 | + $router->resource('makes', 'MakeController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
| 38 | + $router->resource('models', 'ModelController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
| 39 | + $router->resource('purchases', 'PurchaseController', [ 'except' => [ 'create', 'edit', 'update' ] ]); |
|
| 40 | 40 | $router->post('purchases/{id}/guitars', 'GuitarController@store'); |
| 41 | - $router->resource('suppliers', 'SupplierController', ['except' => ['create', 'show', 'edit', 'update']]); |
|
| 42 | - $router->resource('warehouses', 'WarehouseController', ['except' => ['create', 'show', 'edit']]); |
|
| 41 | + $router->resource('suppliers', 'SupplierController', [ 'except' => [ 'create', 'show', 'edit', 'update' ] ]); |
|
| 42 | + $router->resource('warehouses', 'WarehouseController', [ 'except' => [ 'create', 'show', 'edit' ] ]); |
|
| 43 | 43 | }); |
@@ -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 | } |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | public function store($id, Request $request) |
| 20 | 20 | { |
| 21 | 21 | $purchase = Purchase::findOrFail($id); |
| 22 | - if ( ! $purchase->hasArrived() || ! $purchase->isPendingStorage()) { |
|
| 23 | - return response(['purchase' => ['The purchase has not yet arrived or doesn\'t require addition of guitars.']], |
|
| 22 | + if (!$purchase->hasArrived() || !$purchase->isPendingStorage()) { |
|
| 23 | + return response([ 'purchase' => [ 'The purchase has not yet arrived or doesn\'t require addition of guitars.' ] ], |
|
| 24 | 24 | 422); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $this->validate($request, [ |
| 28 | - 'rack_id' => 'required|exists:racks,id,make_id,' . $purchase->make_id, |
|
| 29 | - 'model_id' => 'required|exists:models,id,make_id,' . $purchase->make_id, |
|
| 28 | + 'rack_id' => 'required|exists:racks,id,make_id,'.$purchase->make_id, |
|
| 29 | + 'model_id' => 'required|exists:models,id,make_id,'.$purchase->make_id, |
|
| 30 | 30 | 'colour' => 'required|string|max:255', |
| 31 | 31 | 'damaged' => 'boolean', |
| 32 | 32 | 'condition' => 'required_if:damaged,true', |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $rack = Rack::find($request->input('rack_id')); |
| 37 | 37 | if ($rack->used >= $rack->capacity) { |
| 38 | - return response(['rack_id' => ['The selected rack is full.']], 422); |
|
| 38 | + return response([ 'rack_id' => [ 'The selected rack is full.' ] ], 422); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $guitar = Guitar::create($request->only(['rack_id', 'model_id', 'colour', 'price']) + [ |
|
| 41 | + $guitar = Guitar::create($request->only([ 'rack_id', 'model_id', 'colour', 'price' ]) + [ |
|
| 42 | 42 | 'make_id' => $purchase->make_id, |
| 43 | 43 | 'purchase_id' => $purchase->id, |
| 44 | 44 | 'damaged' => $request->input('damaged'), |