diff --git a/CHANGELOG.md b/CHANGELOG.md index ee47be7f..7d74b29b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ Full changelog for the Costs to Expect REST API. +## 2018-11-10 - v1.08.0 + +* Initial support for PATCHing, to start /resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id}. +* Added initial support for private resource types, if a valid bearer exists private resource types are shown. +* Updates to README around expected responses. +* Renamed route validation helper methods, now clearer when shown in context. + ## 2018-11-03 - v1.07.2 * Route corrections, some routes using unnecessary middleware. diff --git a/README.md b/README.md index afa22159..9de21cd4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Overview -What does it costs to raise a child in the UK? +What does it cost to raise a child in the UK? Costs to Expect is a long-term project, my wife and I are tracking the expenses to raise our child to adulthood, 18. @@ -60,9 +60,10 @@ POSTing to `http://api.local/v1/auth/login` - you will need a bearer for all the * Collections will return an array and 200. * Items will return a single object and a 200. * Successful POST requests will return a single object and a 201. +* Successful PATCH requests will return 204. * Successful DELETE requests will return a 204. * Non 2xx results will return an object with a message field and optionally a fields array, in the -case of a validator error, 422, the fields array will contain the validation errors. +case of a validation error, 422, the fields array will contain the validation errors. ## Pagination @@ -160,6 +161,7 @@ These routes require authorisation. | POST | v1/resource_types/{resource_type_id}/resources | | DELETE | v1/resource_types/{resource_type_id}/resources/{resource_id} | | POST | v1/resource_types/{resource_type_id}/resources/{resource_id}/items | +| PATCH | v1/resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id} | | DELETE | v1/resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id} | | POST | v1/resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id}/category | | DELETE | v1/resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id}/category/{item_category_id} | @@ -174,5 +176,6 @@ These routes require authorisation. * Move the user model. * Dev setting to show generated queries. * Switch to Money class. -* Create a white box version of API. * Add limits on POST for single item collections. +* Additional helper classes +* General refactoring diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 5e0d9c6d..062b35ca 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -67,7 +67,7 @@ function ($category) */ public function show(Request $request, $category_id): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); $this->show_parameters = Get::parameters(['include_sub_categories']); @@ -127,7 +127,7 @@ public function optionsIndex(Request $request): JsonResponse */ public function optionsShow(Request $request, string $category_id): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); return $this->generateOptionsForShow( 'api.descriptions.category.GET_show', @@ -197,7 +197,7 @@ public function delete( string $category_id ): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); try { (new Category())->find($category_id)->delete(); @@ -255,7 +255,7 @@ private function setConditionalGetParameters() ] ]; - (new ResourceType())->paginatedCollection()->map( + (new ResourceType())->paginatedCollection($this->include_private)->map( function ($resource_type) { $this->get_parameters['resource_type']['allowed_values'][$this->hash->encode('resource_type', $resource_type->id)] = [ diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index bccfcf74..218f5fbd 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -9,17 +9,28 @@ use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Contracts\Validation\Validator; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Config; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + /** + * @var \App\Utilities\Hash + */ protected $hash; + /** + * @var bool Include private content + */ + protected $include_private; + public function __construct() { $this->hash = new Hash(); + + $this->include_private = Auth::guard('api')->check(); } /** @@ -148,4 +159,87 @@ protected function generateOptionsForShow( $this->optionsResponse($routes); } + + /** + * Return a 400 as there is nothing to PATCH + * + * @return JsonResponse + */ + protected function returnNothingToPatchError(): JsonResponse + { + response()->json( + [ + 'message' => 'There is nothing to PATCH, please include a request body' + ], + 400 + )->send(); + exit(); + } + + /** + * Return a 400 as there are invalid fields in the request body + * + * @param array $invalid_fields An array of invalid fields + * + * @return JsonResponse + */ + protected function returnInvalidFieldsInRequestError(array $invalid_fields): JsonResponse + { + response()->json( + [ + 'message' => 'Non existent fields in PATCH request body', + 'fields' => $invalid_fields + ], + 400 + )->send(); + exit(); + } + + /** + * Check the request to ensure there is data to attempt patch + * + * @return boolean + */ + protected function isThereAnythingToPatchInRequest(): bool + { + if (count(request()->all()) === 0) { + return false; + } + + return true; + } + + /** + * Return success, no content (204) + * + * @return JsonResponse + */ + protected function returnSuccessNoContent(): JsonResponse + { + response()->json([], 204)->send(); + exit(); + } + + /** + * Check to see if there are any invalid fields in the request + * + * @param array $update_fields An array of fields that can be patched + * + * @return false|array + */ + protected function areThereInvalidFieldsInRequest(array $update_fields) + { + $invalid_fields = []; + foreach (request()->all() as $key => $value) { + if (in_array($key, $update_fields) === false) { + $invalid_fields[] = $key; + } + } + + if (count($invalid_fields) !== 0) { + return $invalid_fields; + } + + return false; + } } diff --git a/app/Http/Controllers/ItemCategoryController.php b/app/Http/Controllers/ItemCategoryController.php index a21ef1f6..62e12e48 100644 --- a/app/Http/Controllers/ItemCategoryController.php +++ b/app/Http/Controllers/ItemCategoryController.php @@ -36,7 +36,7 @@ class ItemCategoryController extends Controller */ public function index(Request $request, string $resource_type_id, string $resource_id, string $item_id): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); $item_category = (new ItemCategory())->paginatedCollection( $resource_type_id, @@ -78,7 +78,7 @@ public function show( string $item_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill') { UtilityRequest::notFound(); @@ -118,7 +118,7 @@ public function show( */ public function optionsIndex(Request $request, string $resource_type_id, string $resource_id, string $item_id): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); $this->setConditionalPostParameters($resource_type_id); @@ -157,7 +157,7 @@ public function optionsShow( string $item_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill') { UtilityRequest::notFound(); @@ -198,7 +198,7 @@ public function create( string $item_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); $validator = (new ItemCategoryValidator)->create($request); diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index b5f10a60..bcf641ac 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -15,6 +15,10 @@ use Illuminate\Database\QueryException; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Rs\Json\Patch; +use Rs\Json\Patch\InvalidOperationException; +use Rs\Json\Patch\InvalidPatchDocumentJsonException; +use Rs\Json\Patch\InvalidTargetDocumentJsonException; /** * Manage items @@ -40,7 +44,7 @@ class ItemController extends Controller */ public function index(Request $request, string $resource_type_id, string $resource_id): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $this->collection_parameters = Get::parameters(['year', 'month', 'category', 'sub_category']); @@ -98,7 +102,7 @@ public function show( string $item_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $item = (new Item())->single($resource_type_id, $resource_id, $item_id); @@ -126,7 +130,7 @@ public function show( */ public function optionsIndex(Request $request, string $resource_type_id, string $resource_id): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $this->collection_parameters = Get::parameters(['year', 'month', 'category', 'sub_category']); @@ -165,7 +169,7 @@ public function optionsShow( string $item_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $item = (new Item())->single($resource_type_id, $resource_id, $item_id); @@ -191,7 +195,7 @@ public function optionsShow( */ public function create(Request $request, string $resource_type_id, string $resource_id): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $validator = (new ItemValidator)->create($request); @@ -224,6 +228,72 @@ public function create(Request $request, string $resource_type_id, string $resou ); } + /** + * Update the selected item + * + * @param Request $request + * @param string $resource_type_id + * @param string $resource_id + * @param string $item_id + * + * @return JsonResponse + */ + public function update( + Request $request, + string $resource_type_id, + string $resource_id, + string $item_id + ): JsonResponse + { + Validate::itemRoute($resource_type_id, $resource_id, $item_id); + + $validator = (new ItemValidator)->update($request); + + if ($validator->fails() === true) { + return $this->returnValidationErrors($validator); + } + + if ($this->isThereAnythingToPatchInRequest() === false) { + return $this->returnNothingToPatchError(); + } + + $invalid_fields = $this->areThereInvalidFieldsInRequest( + (new ItemValidator)->updateFields() + ); + + if ($invalid_fields !== false) { + return $this->returnInvalidFieldsInRequestError($invalid_fields); + } + + $item = (new Item())->single($resource_type_id, $resource_id, $item_id); + + $update_actualised = false; + foreach ($request->all() as $key => $value) { + $item->$key = $value; + + if (in_array($key, ['total', 'percentage']) === true) { + $update_actualised = true; + } + } + + if ($update_actualised === true) { + $item->setActualisedTotal($item->total, $item->percentage); + } + + try { + $item->save(); + } catch (Exception $e) { + return response()->json( + [ + 'message' => 'Error updating record' + ], + 500 + ); + } + + return $this->returnSuccessNoContent(); +} + /** * Delete the assigned item * @@ -241,7 +311,7 @@ public function delete( string $item_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $item = (new Item())->single($resource_type_id, $resource_id, $item_id); @@ -252,7 +322,7 @@ public function delete( try { $item->delete(); - return response()->json([], 204); + return $this->returnSuccessNoContent(); } catch (QueryException $e) { UtilityRequest::foreignKeyConstraintError(); } catch (Exception $e) { diff --git a/app/Http/Controllers/ItemSubCategoryController.php b/app/Http/Controllers/ItemSubCategoryController.php index 7422076b..7dbf09dd 100644 --- a/app/Http/Controllers/ItemSubCategoryController.php +++ b/app/Http/Controllers/ItemSubCategoryController.php @@ -44,7 +44,7 @@ public function index( string $item_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill') { UtilityRequest::notFound(); @@ -93,7 +93,7 @@ public function show( string $item_sub_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill' || $item_sub_category_id === 'nill') { UtilityRequest::notFound(); @@ -141,7 +141,7 @@ public function optionsIndex( string $item_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill') { UtilityRequest::notFound(); @@ -189,7 +189,7 @@ public function optionsShow( string $item_sub_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill' || $item_sub_category_id === 'nill') { UtilityRequest::notFound(); @@ -233,7 +233,7 @@ public function create( string $item_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill') { UtilityRequest::notFound(); @@ -341,7 +341,7 @@ public function delete( string $item_sub_category_id ): JsonResponse { - Validate::item($resource_type_id, $resource_id, $item_id); + Validate::itemRoute($resource_type_id, $resource_id, $item_id); if ($item_category_id === 'nill' || $item_sub_category_id === 'nill') { UtilityRequest::notFound(); diff --git a/app/Http/Controllers/ResourceController.php b/app/Http/Controllers/ResourceController.php index 79864c79..90eef8be 100644 --- a/app/Http/Controllers/ResourceController.php +++ b/app/Http/Controllers/ResourceController.php @@ -31,7 +31,7 @@ class ResourceController extends Controller */ public function index(Request $request, string $resource_type_id): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); $resources = (new Resource)->paginatedCollection($resource_type_id); @@ -66,7 +66,7 @@ public function show( string $resource_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $resource = (new Resource)->single($resource_type_id, $resource_id); @@ -93,7 +93,7 @@ public function show( */ public function optionsIndex(Request $request, string $resource_type_id): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); return $this->generateOptionsForIndex( [ @@ -122,7 +122,7 @@ public function optionsIndex(Request $request, string $resource_type_id): JsonRe */ public function optionsShow(Request $request, string $resource_type_id, string $resource_id): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $resource = (new Resource)->single( $resource_type_id, @@ -150,7 +150,7 @@ public function optionsShow(Request $request, string $resource_type_id, string $ */ public function create(Request $request, string $resource_type_id): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); $validator = (new ResourceValidator)->create($request, $resource_type_id); @@ -196,7 +196,7 @@ public function delete( string $resource_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); try { (new Resource())->find($resource_id)->delete(); diff --git a/app/Http/Controllers/ResourceTypeController.php b/app/Http/Controllers/ResourceTypeController.php index c4660341..24962d69 100644 --- a/app/Http/Controllers/ResourceTypeController.php +++ b/app/Http/Controllers/ResourceTypeController.php @@ -34,7 +34,7 @@ class ResourceTypeController extends Controller */ public function index(Request $request): JsonResponse { - $resource_types = (new ResourceType())->paginatedCollection(); + $resource_types = (new ResourceType())->paginatedCollection($this->include_private); $this->collection_parameters = Get::parameters(['include_resources']); @@ -64,11 +64,11 @@ function ($resource_type) */ public function show(Request $request, string $resource_type_id): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); $this->show_parameters = Get::parameters(['include_resources']); - $resource_type = (new ResourceType())->single($resource_type_id); + $resource_type = (new ResourceType())->single($resource_type_id, $this->include_private); if ($resource_type === null) { UtilityRequest::notFound(); @@ -118,7 +118,7 @@ public function optionsIndex(Request $request): JsonResponse */ public function optionsShow(Request $request, string $resource_type_id): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); return $this->generateOptionsForShow( 'api.descriptions.resource_type.GET_show', @@ -136,7 +136,7 @@ public function optionsShow(Request $request, string $resource_type_id): JsonRes */ public function create(Request $request): JsonResponse { - $validator = (new ResourceTypeValidator)->create($request); + $validator = (new ResourceTypeValidator)->create($request, $this->include_private); if ($validator->fails() === true) { return $this->returnValidationErrors($validator); @@ -145,7 +145,8 @@ public function create(Request $request): JsonResponse try { $resource_type = new ResourceType([ 'name' => $request->input('name'), - 'description' => $request->input('description') + 'description' => $request->input('description'), + 'private' => $request->input('private', 0) ]); $resource_type->save(); } catch (Exception $e) { @@ -176,7 +177,7 @@ public function delete( string $resource_type_id ): JsonResponse { - Validate::resourceType($resource_type_id); + Validate::resourceTypeRoute($resource_type_id); try { (new ResourceType())->find($resource_type_id)->delete(); diff --git a/app/Http/Controllers/SubCategoryController.php b/app/Http/Controllers/SubCategoryController.php index 7d0008ad..bef5cc73 100644 --- a/app/Http/Controllers/SubCategoryController.php +++ b/app/Http/Controllers/SubCategoryController.php @@ -31,7 +31,7 @@ class SubCategoryController extends Controller */ public function index(Request $request, string $category_id): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); $sub_categories = (new SubCategory())->paginatedCollection($category_id); @@ -66,7 +66,7 @@ public function show( string $sub_category_id ): JsonResponse { - Validate::subCategory($category_id, $sub_category_id); + Validate::subCategoryRoute($category_id, $sub_category_id); $sub_category = (new SubCategory())->single( $category_id, @@ -96,7 +96,7 @@ public function show( */ public function optionsIndex(Request $request, string $category_id): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); return $this->generateOptionsForIndex( [ @@ -129,7 +129,7 @@ public function optionsShow( string $sub_category_id ): JsonResponse { - Validate::subCategory($category_id, $sub_category_id); + Validate::subCategoryRoute($category_id, $sub_category_id); return $this->generateOptionsForShow( 'api.descriptions.sub_category.GET_show', @@ -148,7 +148,7 @@ public function optionsShow( */ public function create(Request $request, string $category_id): JsonResponse { - Validate::category($category_id); + Validate::categoryRoute($category_id); $validator = (new SubCategoryValidator)->create($request, $category_id); @@ -193,7 +193,7 @@ public function delete( string $sub_category_id ): JsonResponse { - Validate::subCategory($category_id, $sub_category_id); + Validate::subCategoryRoute($category_id, $sub_category_id); $sub_category = (new SubCategory())->single( $category_id, diff --git a/app/Http/Controllers/SummaryController.php b/app/Http/Controllers/SummaryController.php index 50736865..7a29aa56 100644 --- a/app/Http/Controllers/SummaryController.php +++ b/app/Http/Controllers/SummaryController.php @@ -33,7 +33,7 @@ class SummaryController extends Controller */ public function tco(Request $request, string $resource_type_id, string $resource_id): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $summary = (new Item())->summary($resource_type_id, $resource_id); @@ -59,7 +59,7 @@ public function tco(Request $request, string $resource_type_id, string $resource */ public function optionsTco(Request $request, string $resource_type_id, string $resource_id) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ @@ -87,7 +87,7 @@ public function categories( string $resource_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $summary = (new Item())->categoriesSummary( $resource_type_id, @@ -118,7 +118,7 @@ function ($category_summary) { */ public function optionsCategories(Request $request, string $resource_type_id, string $resource_id) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ @@ -148,9 +148,9 @@ public function category( string $category_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::category($category_id); + Validate::categoryRoute($category_id); $category_summary = (new Item())->categorySummary( $resource_type_id, @@ -187,9 +187,9 @@ public function optionsCategory( string $resource_id, string $category_id ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::category($category_id); + Validate::categoryRoute($category_id); $routes = [ 'GET' => [ @@ -219,9 +219,9 @@ public function subCategories( string $category_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::category($category_id); + Validate::categoryRoute($category_id); $summary = (new Item())->subCategoriesSummary( $resource_type_id, @@ -258,9 +258,9 @@ public function optionsSubCategories( string $resource_id, string $category_id ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::category($category_id); + Validate::categoryRoute($category_id); $routes = [ 'GET' => [ @@ -292,9 +292,9 @@ public function subCategory( string $sub_category_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::subCategory($category_id, $sub_category_id); + Validate::subCategoryRoute($category_id, $sub_category_id); $sub_category_summary = (new Item())->subCategorySummary( $resource_type_id, @@ -334,9 +334,9 @@ public function optionsSubCategory( string $category_id, string $sub_category_id ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); - Validate::subCategory($category_id, $sub_category_id); + Validate::subCategoryRoute($category_id, $sub_category_id); $routes = [ 'GET' => [ @@ -364,7 +364,7 @@ public function years( string $resource_id ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $summary = (new Item())->yearsSummary( $resource_type_id, @@ -398,7 +398,7 @@ public function optionsYears( string $resource_type_id, string $resource_id ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ @@ -428,7 +428,7 @@ public function year( string $year ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $year_summary = (new Item())->yearSummary( $resource_type_id, @@ -468,7 +468,7 @@ public function months( int $year ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $summary = (new Item())->monthsSummary( $resource_type_id, @@ -504,7 +504,7 @@ public function optionsMonths( string $resource_id, int $year ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ @@ -531,7 +531,7 @@ public function optionsYear( string $resource_id, string $year ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ @@ -563,7 +563,7 @@ public function month( int $month ): JsonResponse { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $summary = (new Item())->monthSummary( $resource_type_id, @@ -603,7 +603,7 @@ public function optionsMonth( string $year, string $month ) { - Validate::resource($resource_type_id, $resource_id); + Validate::resourceRoute($resource_type_id, $resource_id); $routes = [ 'GET' => [ diff --git a/app/Http/Parameters/Request/Validators/Item.php b/app/Http/Parameters/Request/Validators/Item.php index 8862bc57..8f3741b8 100644 --- a/app/Http/Parameters/Request/Validators/Item.php +++ b/app/Http/Parameters/Request/Validators/Item.php @@ -32,4 +32,25 @@ public function create(Request $request): Validator Config::get('api.routes.item.validation.POST.messages') ); } + + /** + * Return the validator object for the update request + * + * @param Request $request + * + * @return Validator + */ + public function update(Request $request): Validator + { + return ValidatorFacade::make( + $request->all(), + Config::get('api.routes.item.validation.PATCH.fields'), + Config::get('api.routes.item.validation.PATCH.messages') + ); + } + + public function updateFields() + { + return array_keys(Config::get('api.routes.item.validation.PATCH.fields')); + } } diff --git a/app/Http/Parameters/Route/Validate.php b/app/Http/Parameters/Route/Validate.php index a0108e00..96b8ca89 100644 --- a/app/Http/Parameters/Route/Validate.php +++ b/app/Http/Parameters/Route/Validate.php @@ -20,35 +20,35 @@ */ class Validate { - static public function category($category_id) + static public function categoryRoute($category_id) { if (Category::validate($category_id) === false) { UtilityRequest::notFound('Category not found'); } } - static public function subCategory($category_id, $sub_category_id) + static public function subCategoryRoute($category_id, $sub_category_id) { if (SubCategory::validate($category_id, $sub_category_id) === false) { UtilityRequest::notFound('Sub category not found'); } } - static public function resourceType($resource_type_id) + static public function resourceTypeRoute($resource_type_id) { if (ResourceType::validate($resource_type_id) === false) { UtilityRequest::notFound('Resource type not found'); } } - static public function resource($resource_type_id, $resource_id) + static public function resourceRoute($resource_type_id, $resource_id) { if (Resource::validate($resource_type_id, $resource_id) === false) { UtilityRequest::notFound('Resource not found'); } } - static public function item($resource_type_id, $resource_id, $item_id) + static public function itemRoute($resource_type_id, $resource_id, $item_id) { if (Item::validate($resource_type_id, $resource_id, $item_id) === false) { UtilityRequest::notFound('Item not found'); diff --git a/app/Models/ResourceType.php b/app/Models/ResourceType.php index 10e55bff..90e06b0c 100644 --- a/app/Models/ResourceType.php +++ b/app/Models/ResourceType.php @@ -30,14 +30,39 @@ public function resources_count() return $this->hasMany(Resource::class, 'resource_type_id', 'id')->count(); } - public function paginatedCollection(int $offset = 0, int $limit = 10) + /** + * Return the paginated collection + * + * @param boolean $include_private Also include private resource type + * @param integer $offset Paging offset + * @param integer $limit Paging limit + * @return mixed + */ + public function paginatedCollection(bool $include_private, int $offset = 0, int $limit = 10) { - return $this->latest()->get(); + $collection = $this->latest(); + + if ($include_private === false) { + $collection->where('private', '=', 0); + } + + return $collection->get(); } - public function single(int $resource_type_id) + /** + * Return a single item + * + * @param integer $resource_type_id Resource type to return + * @param boolean $include_private Add additional check to ensure we don't return private resource types + * @return mixed + */ + public function single(int $resource_type_id, bool $include_private) { - return $this->find($resource_type_id); + if ($include_private === false) { + return $this->where('private', '=', 0)->find($resource_type_id); + } else { + return $this->find($resource_type_id); + } } /** diff --git a/app/Transformers/ResourceType.php b/app/Transformers/ResourceType.php index b217f77c..8e2b7921 100644 --- a/app/Transformers/ResourceType.php +++ b/app/Transformers/ResourceType.php @@ -45,6 +45,7 @@ public function toArray(): array 'name' => $this->resource_type->name, 'description' => $this->resource_type->description, 'created' => $this->resource_type->created_at->toDateTimeString(), + 'public' => !boolval($this->resource_type->private), 'resources_count' => $this->resource_type->resources_count() ]; diff --git a/app/Transformers/Transformer.php b/app/Transformers/Transformer.php index dc3431de..6dfb6b1c 100644 --- a/app/Transformers/Transformer.php +++ b/app/Transformers/Transformer.php @@ -21,4 +21,9 @@ public function __construct() } abstract public function toArray(): array; + + public function toJson(): string + { + return json_encode($this->toArray()); + } } diff --git a/composer.json b/composer.json index 6215d3fb..64331703 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "type": "project", "require": { "php": "^7.2", + "ext-json": "*", "fideloper/proxy": "^4.0", "hashids/hashids": "^3.0", "laravel/framework": "5.6.*", diff --git a/composer.lock b/composer.lock index 66f981d1..3b1c574d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "23211615ca89d2c1b4569c3009555af1", - "content-hash": "0578da451e78bac555b9dd66f8b368c2", + "hash": "4370ab3c5ac2619fc0d2ee75ae3a643a", + "content-hash": "1aaa72a5a3c6bc6abc939a8feb0e4828", "packages": [ { "name": "defuse/php-encryption", @@ -275,16 +275,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.5", + "version": "2.1.6", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3" + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3", - "reference": "54859fabea8b3beecbb1a282888d5c990036b9e3", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786", + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786", "shasum": "" }, "require": { @@ -328,7 +328,7 @@ "validation", "validator" ], - "time": "2018-08-16 20:49:45" + "time": "2018-09-25 20:47:26" }, { "name": "erusev/parsedown", @@ -725,32 +725,32 @@ }, { "name": "jakub-onderka/php-console-color", - "version": "0.1", + "version": "v0.2", "source": { "type": "git", "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191", + "reference": "d5deaecff52a0d61ccb613bb3804088da0307191", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.4.0" }, "require-dev": { "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-parallel-lint": "1.0", "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "~4.3", "squizlabs/php_codesniffer": "1.*" }, "type": "library", "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" + "psr-4": { + "JakubOnderka\\PhpConsoleColor\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -760,11 +760,10 @@ "authors": [ { "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" + "email": "jakub.onderka@gmail.com" } ], - "time": "2014-04-08 15:00:19" + "time": "2018-09-29 17:23:10" }, { "name": "jakub-onderka/php-console-highlighter", @@ -812,16 +811,16 @@ }, { "name": "laravel/framework", - "version": "v5.6.38", + "version": "v5.6.39", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "38d838bab9434af79e8ab274ae63f52f7ed45d6e" + "reference": "37bb306f516669ab4f888c16003f694313ab299e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/38d838bab9434af79e8ab274ae63f52f7ed45d6e", - "reference": "38d838bab9434af79e8ab274ae63f52f7ed45d6e", + "url": "https://api.github.com/repos/laravel/framework/zipball/37bb306f516669ab4f888c16003f694313ab299e", + "reference": "37bb306f516669ab4f888c16003f694313ab299e", "shasum": "" }, "require": { @@ -947,7 +946,7 @@ "framework", "laravel" ], - "time": "2018-09-04 13:15:09" + "time": "2018-10-04 14:50:41" }, { "name": "laravel/passport", @@ -1020,16 +1019,16 @@ }, { "name": "laravel/tinker", - "version": "v1.0.7", + "version": "v1.0.8", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d" + "reference": "cafbf598a90acde68985660e79b2b03c5609a405" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", - "reference": "e3086ee8cb1f54a39ae8dcb72d1c37d10128997d", + "url": "https://api.github.com/repos/laravel/tinker/zipball/cafbf598a90acde68985660e79b2b03c5609a405", + "reference": "cafbf598a90acde68985660e79b2b03c5609a405", "shasum": "" }, "require": { @@ -1079,7 +1078,7 @@ "laravel", "psysh" ], - "time": "2018-05-17 13:42:07" + "time": "2018-10-12 19:39:35" }, { "name": "lcobucci/jwt", @@ -1191,26 +1190,26 @@ }, { "name": "league/flysystem", - "version": "1.0.46", + "version": "1.0.48", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2" + "reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2", - "reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a6ded5b2f6055e2db97b4b859fdfca2b952b78aa", + "reference": "a6ded5b2f6055e2db97b4b859fdfca2b952b78aa", "shasum": "" }, "require": { + "ext-fileinfo": "*", "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "ext-fileinfo": "*", "phpspec/phpspec": "^3.4", "phpunit/phpunit": "^5.7.10" }, @@ -1271,7 +1270,7 @@ "sftp", "storage" ], - "time": "2018-08-22 07:45:22" + "time": "2018-10-15 13:53:10" }, { "name": "league/oauth2-server", @@ -1345,16 +1344,16 @@ }, { "name": "monolog/monolog", - "version": "1.23.0", + "version": "1.24.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", "shasum": "" }, "require": { @@ -1419,7 +1418,7 @@ "logging", "psr-3" ], - "time": "2017-06-19 01:22:40" + "time": "2018-11-05 09:00:11" }, { "name": "nesbot/carbon", @@ -1476,16 +1475,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.0.3", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" + "reference": "d0230c5c77a7e3cfa69446febf340978540958c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0", + "reference": "d0230c5c77a7e3cfa69446febf340978540958c0", "shasum": "" }, "require": { @@ -1501,7 +1500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -1523,7 +1522,7 @@ "parser", "php" ], - "time": "2018-07-15 17:25:16" + "time": "2018-10-10 09:24:14" }, { "name": "paragonie/random_compat", @@ -1572,16 +1571,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.11", + "version": "2.0.12", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b" + "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b", - "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/8814dc7841db159daed0b32c2b08fb7e03c6afe7", + "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7", "shasum": "" }, "require": { @@ -1660,7 +1659,7 @@ "x.509", "x509" ], - "time": "2018-04-15 16:55:05" + "time": "2018-11-04 05:45:48" }, { "name": "psr/container", @@ -1858,23 +1857,23 @@ }, { "name": "psy/psysh", - "version": "v0.9.8", + "version": "v0.9.9", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555" + "reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/ed3c32c4304e1a678a6e0f9dc11dd2d927d89555", - "reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/9aaf29575bb8293206bb0420c1e1c87ff2ffa94e", + "reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e", "shasum": "" }, "require": { "dnoegel/php-xdg-base-dir": "0.1", "ext-json": "*", "ext-tokenizer": "*", - "jakub-onderka/php-console-highlighter": "0.3.*", + "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", "php": ">=5.4.0", "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0", @@ -1928,7 +1927,7 @@ "interactive", "shell" ], - "time": "2018-09-05 11:40:09" + "time": "2018-10-13 15:16:03" }, { "name": "ramsey/uuid", @@ -2014,16 +2013,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.1.2", + "version": "v6.1.3", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8" + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7d760881d266d63c5e7a1155cbcf2ac656a31ca8", - "reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4", "shasum": "" }, "require": { @@ -2069,20 +2068,20 @@ "mail", "mailer" ], - "time": "2018-07-13 07:04:35" + "time": "2018-09-11 07:12:52" }, { "name": "symfony/console", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" + "reference": "432122af37d8cd52fba1b294b11976e0d20df595" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", + "url": "https://api.github.com/repos/symfony/console/zipball/432122af37d8cd52fba1b294b11976e0d20df595", + "reference": "432122af37d8cd52fba1b294b11976e0d20df595", "shasum": "" }, "require": { @@ -2137,20 +2136,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-26 11:24:31" + "time": "2018-10-31 09:30:44" }, { "name": "symfony/css-selector", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "2a4df7618f869b456f9096781e78c57b509d76c7" + "reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/2a4df7618f869b456f9096781e78c57b509d76c7", - "reference": "2a4df7618f869b456f9096781e78c57b509d76c7", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/d67de79a70a27d93c92c47f37ece958bf8de4d8a", + "reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a", "shasum": "" }, "require": { @@ -2190,20 +2189,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-07-26 09:10:45" + "time": "2018-10-02 16:36:10" }, { "name": "symfony/debug", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "47ead688f1f2877f3f14219670f52e4722ee7052" + "reference": "19090917b848a799cbae4800abf740fe4eb71c1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/47ead688f1f2877f3f14219670f52e4722ee7052", - "reference": "47ead688f1f2877f3f14219670f52e4722ee7052", + "url": "https://api.github.com/repos/symfony/debug/zipball/19090917b848a799cbae4800abf740fe4eb71c1d", + "reference": "19090917b848a799cbae4800abf740fe4eb71c1d", "shasum": "" }, "require": { @@ -2246,20 +2245,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-08-03 11:13:38" + "time": "2018-10-31 09:09:42" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" + "reference": "552541dad078c85d9414b09c041ede488b456cd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", - "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/552541dad078c85d9414b09c041ede488b456cd5", + "reference": "552541dad078c85d9414b09c041ede488b456cd5", "shasum": "" }, "require": { @@ -2309,20 +2308,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-26 09:10:45" + "time": "2018-10-10 13:52:42" }, { "name": "symfony/finder", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "url": "https://api.github.com/repos/symfony/finder/zipball/1f17195b44543017a9c9b2d437c670627e96ad06", + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06", "shasum": "" }, "require": { @@ -2358,20 +2357,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-07-26 11:24:31" + "time": "2018-10-03 08:47:56" }, { "name": "symfony/http-foundation", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345" + "reference": "82d494c1492b0dd24bbc5c2d963fb02eb44491af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/82d494c1492b0dd24bbc5c2d963fb02eb44491af", + "reference": "82d494c1492b0dd24bbc5c2d963fb02eb44491af", "shasum": "" }, "require": { @@ -2412,20 +2411,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-08-27 17:47:02" + "time": "2018-10-31 09:09:42" }, { "name": "symfony/http-kernel", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35" + "reference": "958be64ab13b65172ad646ef5ae20364c2305fae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/33de0a1ff2e1720096189e3ced682d7a4e8f5e35", - "reference": "33de0a1ff2e1720096189e3ced682d7a4e8f5e35", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/958be64ab13b65172ad646ef5ae20364c2305fae", + "reference": "958be64ab13b65172ad646ef5ae20364c2305fae", "shasum": "" }, "require": { @@ -2499,11 +2498,11 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-08-28 06:17:42" + "time": "2018-11-03 11:11:23" }, { "name": "symfony/polyfill-ctype", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -2561,16 +2560,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -2616,20 +2615,20 @@ "portable", "shim" ], - "time": "2018-08-06 14:22:27" + "time": "2018-09-21 13:07:52" }, { "name": "symfony/polyfill-php72", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", "shasum": "" }, "require": { @@ -2671,20 +2670,20 @@ "portable", "shim" ], - "time": "2018-08-06 14:22:27" + "time": "2018-09-21 13:07:52" }, { "name": "symfony/process", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843" + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843", + "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", "shasum": "" }, "require": { @@ -2720,7 +2719,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-08-03 11:13:38" + "time": "2018-10-14 20:48:13" }, { "name": "symfony/psr-http-message-bridge", @@ -2785,16 +2784,16 @@ }, { "name": "symfony/routing", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "a5784c2ec4168018c87b38f0e4f39d2278499f51" + "reference": "d4a3c14cfbe6b9c05a1d6e948654022d4d1ad3fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/a5784c2ec4168018c87b38f0e4f39d2278499f51", - "reference": "a5784c2ec4168018c87b38f0e4f39d2278499f51", + "url": "https://api.github.com/repos/symfony/routing/zipball/d4a3c14cfbe6b9c05a1d6e948654022d4d1ad3fd", + "reference": "d4a3c14cfbe6b9c05a1d6e948654022d4d1ad3fd", "shasum": "" }, "require": { @@ -2858,20 +2857,20 @@ "uri", "url" ], - "time": "2018-08-03 07:58:40" + "time": "2018-10-28 18:38:52" }, { "name": "symfony/translation", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f" + "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/fa2182669f7983b7aa5f1a770d053f79f0ef144f", - "reference": "fa2182669f7983b7aa5f1a770d053f79f0ef144f", + "url": "https://api.github.com/repos/symfony/translation/zipball/aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c", + "reference": "aa04dc1c75b7d3da7bd7003104cd0cfc5dff635c", "shasum": "" }, "require": { @@ -2927,20 +2926,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-08-07 12:45:11" + "time": "2018-10-28 18:38:52" }, { "name": "symfony/var-dumper", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "a05426e27294bba7b0226ffc17dd01a3c6ef9777" + "reference": "60319b45653580b0cdacca499344577d87732f16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/a05426e27294bba7b0226ffc17dd01a3c6ef9777", - "reference": "a05426e27294bba7b0226ffc17dd01a3c6ef9777", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/60319b45653580b0cdacca499344577d87732f16", + "reference": "60319b45653580b0cdacca499344577d87732f16", "shasum": "" }, "require": { @@ -3002,7 +3001,7 @@ "debug", "dump" ], - "time": "2018-08-02 09:24:26" + "time": "2018-10-02 16:36:10" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -3169,16 +3168,16 @@ "packages-dev": [ { "name": "barryvdh/laravel-ide-helper", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-ide-helper.git", - "reference": "7db1843473e1562d8e0490b51db847d3a1415140" + "reference": "981ff45b43e0cf808af0a5a5f40f6369e0e29499" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/7db1843473e1562d8e0490b51db847d3a1415140", - "reference": "7db1843473e1562d8e0490b51db847d3a1415140", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/981ff45b43e0cf808af0a5a5f40f6369e0e29499", + "reference": "981ff45b43e0cf808af0a5a5f40f6369e0e29499", "shasum": "" }, "require": { @@ -3239,20 +3238,20 @@ "phpstorm", "sublime" ], - "time": "2018-09-06 18:41:09" + "time": "2018-10-06 09:35:51" }, { "name": "barryvdh/reflection-docblock", - "version": "v2.0.4", + "version": "v2.0.5", "source": { "type": "git", "url": "https://github.com/barryvdh/ReflectionDocBlock.git", - "reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c" + "reference": "64165bd4ba9a550d11ea57569463b7c722dc6b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/3dcbd98b5d9384a5357266efba8fd29884458e5c", - "reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c", + "url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/64165bd4ba9a550d11ea57569463b7c722dc6b0a", + "reference": "64165bd4ba9a550d11ea57569463b7c722dc6b0a", "shasum": "" }, "require": { @@ -3288,20 +3287,20 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2016-06-13 19:28:20" + "time": "2018-10-25 19:09:52" }, { "name": "composer/ca-bundle", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0" + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0", - "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660", + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660", "shasum": "" }, "require": { @@ -3344,20 +3343,20 @@ "ssl", "tls" ], - "time": "2018-08-08 08:57:40" + "time": "2018-10-18 06:09:13" }, { "name": "composer/composer", - "version": "1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "576aab9b5abb2ed11a1c52353a759363216a4ad2" + "reference": "e965b9aaa8854c3067f1ed2ae45f436572d73eb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/576aab9b5abb2ed11a1c52353a759363216a4ad2", - "reference": "576aab9b5abb2ed11a1c52353a759363216a4ad2", + "url": "https://api.github.com/repos/composer/composer/zipball/e965b9aaa8854c3067f1ed2ae45f436572d73eb7", + "reference": "e965b9aaa8854c3067f1ed2ae45f436572d73eb7", "shasum": "" }, "require": { @@ -3424,7 +3423,7 @@ "dependency", "package" ], - "time": "2018-08-16 14:57:12" + "time": "2018-11-01 09:05:06" }, { "name": "composer/semver", @@ -3490,16 +3489,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b" + "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b", - "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7a9556b22bd9d4df7cad89876b00af58ef20d3a2", + "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2", "shasum": "" }, "require": { @@ -3547,7 +3546,7 @@ "spdx", "validator" ], - "time": "2018-04-30 10:33:04" + "time": "2018-11-01 09:45:54" }, { "name": "composer/xdebug-handler", @@ -3649,16 +3648,16 @@ }, { "name": "filp/whoops", - "version": "2.2.1", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311" + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/e79cd403fb77fc8963a99ecc30e80ddd885b3311", - "reference": "e79cd403fb77fc8963a99ecc30e80ddd885b3311", + "url": "https://api.github.com/repos/filp/whoops/zipball/bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", + "reference": "bc0fd11bc455cc20ee4b5edabc63ebbf859324c7", "shasum": "" }, "require": { @@ -3706,7 +3705,7 @@ "throwable", "whoops" ], - "time": "2018-06-30 13:14:06" + "time": "2018-10-23 09:00:00" }, { "name": "fzaninotto/faker", @@ -3874,16 +3873,16 @@ }, { "name": "mockery/mockery", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" + "reference": "100633629bf76d57430b86b7098cd6beb996a35a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", + "url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a", + "reference": "100633629bf76d57430b86b7098cd6beb996a35a", "shasum": "" }, "require": { @@ -3892,8 +3891,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpdocumentor/phpdocumentor": "^2.9", - "phpunit/phpunit": "~5.7.10|~6.5" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0" }, "type": "library", "extra": { @@ -3936,7 +3934,7 @@ "test double", "testing" ], - "time": "2018-05-08 08:54:48" + "time": "2018-10-02 21:52:37" }, { "name": "myclabs/deep-copy", @@ -3988,16 +3986,16 @@ }, { "name": "nunomaduro/collision", - "version": "v2.0.3", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "b1f606399ae77e9479b5597cd1aa3d8ea0078176" + "reference": "1149ad9f36f61b121ae61f5f6de820fc77b51e6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/b1f606399ae77e9479b5597cd1aa3d8ea0078176", - "reference": "b1f606399ae77e9479b5597cd1aa3d8ea0078176", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/1149ad9f36f61b121ae61f5f6de820fc77b51e6b", + "reference": "1149ad9f36f61b121ae61f5f6de820fc77b51e6b", "shasum": "" }, "require": { @@ -4007,9 +4005,9 @@ "symfony/console": "~2.8|~3.3|~4.0" }, "require-dev": { - "laravel/framework": "5.6.*", - "phpstan/phpstan": "^0.9.2", - "phpunit/phpunit": "~7.2" + "laravel/framework": "5.7.*", + "phpstan/phpstan": "^0.10", + "phpunit/phpunit": "~7.3" }, "type": "library", "extra": { @@ -4047,7 +4045,7 @@ "php", "symfony" ], - "time": "2018-06-16 22:05:52" + "time": "2018-10-03 20:01:54" }, { "name": "phar-io/manifest", @@ -4368,16 +4366,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.0.7", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { @@ -4388,7 +4386,7 @@ "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -4401,7 +4399,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -4427,25 +4425,28 @@ "testing", "xunit" ], - "time": "2018-06-01 07:51:50" + "time": "2018-10-31 16:06:48" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -4474,7 +4475,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11 11:44:00" + "time": "2018-09-13 20:33:42" }, { "name": "phpunit/php-text-template", @@ -4568,16 +4569,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", "shasum": "" }, "require": { @@ -4613,20 +4614,20 @@ "keywords": [ "tokenizer" ], - "time": "2018-02-01 13:16:43" + "time": "2018-10-30 05:52:18" }, { "name": "phpunit/phpunit", - "version": "7.3.5", + "version": "7.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7b331efabbb628c518c408fdfcaf571156775de2" + "reference": "c151651fb6ed264038d486ea262e243af72e5e64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b331efabbb628c518c408fdfcaf571156775de2", - "reference": "7b331efabbb628c518c408fdfcaf571156775de2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64", + "reference": "c151651fb6ed264038d486ea262e243af72e5e64", "shasum": "" }, "require": { @@ -4647,11 +4648,11 @@ "phpunit/php-timer": "^2.0", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { @@ -4671,7 +4672,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.3-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -4697,7 +4698,7 @@ "testing", "xunit" ], - "time": "2018-09-08 15:14:29" + "time": "2018-10-23 05:57:41" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -5179,25 +5180,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -5217,7 +5218,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2018-10-04 04:07:39" }, { "name": "sebastian/version", @@ -5357,16 +5358,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.1.4", + "version": "v4.1.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e" + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd7bd6535beb1f0a0a9e3ee960666d0598546981", + "reference": "fd7bd6535beb1f0a0a9e3ee960666d0598546981", "shasum": "" }, "require": { @@ -5403,7 +5404,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-08-18 16:52:46" + "time": "2018-10-30 13:18:25" }, { "name": "theseer/tokenizer", @@ -5502,7 +5503,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.2" + "php": "^7.2", + "ext-json": "*" }, "platform-dev": [] } diff --git a/config/api/routes.php b/config/api/routes.php index f742c8eb..f8fea6c3 100644 --- a/config/api/routes.php +++ b/config/api/routes.php @@ -122,13 +122,21 @@ 'description' => 'Enter a description for the resource type', 'type' => 'string', 'required' => true + ], + 'private' => [ + 'field' => 'private', + 'title' => 'Is the a private resource type', + 'description' => 'Please set whether this should be marked as a private resource type', + 'type' => 'boolean', + 'required' => true ] ], 'validation' => [ 'POST' => [ 'fields' => [ 'name' => 'required|string|unique:resource_type,name', - 'description' => 'required|string' + 'description' => 'required|string', + 'private' => 'sometimes|boolean', ], 'messages' => [ 'name.unique' => 'The resource type has already been used' @@ -243,7 +251,18 @@ 'percentage' => 'sometimes|required|integer|between:1,100' ], 'messages' => [ - 'total.regex' => "Total cost in the format 0.00" + 'total.regex' => "Total cost must be in the format 0.00" + ] + ], + 'PATCH' => [ + 'fields' => [ + 'description' => 'sometimes|string', + 'effective_date' => 'sometimes|date_format:Y-m-d', + 'total' => 'sometimes|string|regex:/^\d+\.\d{2}$/', + 'percentage' => 'sometimes|integer|between:1,100' + ], + 'messages' => [ + 'total.regex' => "Total cost must be in the format 0.00" ] ] ], diff --git a/config/api/version.php b/config/api/version.php index ec6dc883..cf7ab95e 100644 --- a/config/api/version.php +++ b/config/api/version.php @@ -1,9 +1,9 @@ '1.07.2', + 'version'=> '1.08.0', 'prefix' => 'v1', - 'release_date' => '2018-11-03', + 'release_date' => '2018-11-10', 'changelog' => [ 'api' => '/v1/changelog', 'markdown' => 'https://github.com/costs-to-expect/api/blob/master/CHANGELOG.md' diff --git a/database/migrations/2018_11_05_234207_add_private_to_resource_type_table.php b/database/migrations/2018_11_05_234207_add_private_to_resource_type_table.php new file mode 100644 index 00000000..e0788ccf --- /dev/null +++ b/database/migrations/2018_11_05_234207_add_private_to_resource_type_table.php @@ -0,0 +1,36 @@ +tinyInteger('private') + ->after('id') + ->default(0); + $table->index('private'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('resource_type', function (Blueprint $table) { + $table->dropIndex('resource_type_private_index'); + $table->dropColumn('private'); + }); + } +} diff --git a/routes/api/auth-api_convert-route-params.php b/routes/api/auth-api_convert-route-params.php index a6f208be..2c587c2d 100644 --- a/routes/api/auth-api_convert-route-params.php +++ b/routes/api/auth-api_convert-route-params.php @@ -71,5 +71,10 @@ function () { 'resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id}/category/{item_category_id}/sub_category/{item_sub_category_id}', 'ItemSubCategoryController@delete' ); + + Route::patch( + 'resource_types/{resource_type_id}/resources/{resource_id}/items/{item_id}', + 'ItemController@update' + ); } );