diff --git a/app/Console/Commands/ComputeDailyReportCommand.php b/app/Console/Commands/ComputeDailyReportCommand.php index c8cccd95f..87ed1197e 100644 --- a/app/Console/Commands/ComputeDailyReportCommand.php +++ b/app/Console/Commands/ComputeDailyReportCommand.php @@ -79,7 +79,7 @@ public function computeMonthReport() /** * let's show how it progresses */ - $this->withProgressBar( $dates, function( $date ) use ( $reportService ) { + $this->withProgressBar( $dates, function ( $date ) use ( $reportService ) { $reportService->computeDashboardMonth( $date ); }); @@ -119,7 +119,7 @@ public function computeDayReport() /** * let's show how it progresses */ - $this->withProgressBar( $dates, function( $date ) use ( $reportService ) { + $this->withProgressBar( $dates, function ( $date ) use ( $reportService ) { $reportService->computeDayReport( $date->startOfDay()->toDateTimeString(), $date->endOfDay()->toDateTimeString() diff --git a/app/Console/Commands/DoctorCommand.php b/app/Console/Commands/DoctorCommand.php index b5f7257f9..971c49faf 100644 --- a/app/Console/Commands/DoctorCommand.php +++ b/app/Console/Commands/DoctorCommand.php @@ -96,7 +96,7 @@ public function handle() */ $productService = app()->make( ProductService::class ); - $this->withProgressBar( $products, function( OrderProduct $orderProduct ) use ( $productService ) { + $this->withProgressBar( $products, function ( OrderProduct $orderProduct ) use ( $productService ) { $orderProduct->total_purchase_price = $productService->getLastPurchasePrice( $orderProduct->product ) * $orderProduct->quantity; $orderProduct->save(); }); diff --git a/app/Console/Commands/ExtractTranslation.php b/app/Console/Commands/ExtractTranslation.php index 0ef14bf0e..e44898ca7 100644 --- a/app/Console/Commands/ExtractTranslation.php +++ b/app/Console/Commands/ExtractTranslation.php @@ -183,14 +183,14 @@ private function flushTranslation( $newTranslation, $filePath ) * delete all keys that doesn't exists */ $purgedTranslation = collect( $existingTranslation ) - ->filter( function( $translation, $key ) use ( $newTranslation ) { + ->filter( function ( $translation, $key ) use ( $newTranslation ) { return in_array( $key, array_keys( $newTranslation ) ); }); /** * pull new keys */ - $newKeys = collect( $newTranslation )->filter( function( $translation, $key ) use ( $existingTranslation ) { + $newKeys = collect( $newTranslation )->filter( function ( $translation, $key ) use ( $existingTranslation ) { return ! in_array( $key, array_keys( $existingTranslation ) ); }); @@ -204,7 +204,7 @@ private function extractLocalization( $files ) { $supportedExtensions = [ 'vue', 'php', 'ts', 'js' ]; - $filtered = collect( $files )->filter( function( $file ) use ( $supportedExtensions ) { + $filtered = collect( $files )->filter( function ( $file ) use ( $supportedExtensions ) { $info = pathinfo( $file ); return in_array( $info[ 'extension' ], $supportedExtensions ); @@ -216,7 +216,7 @@ private function extractLocalization( $files ) * we'll extract all the string that can be translated * and save them within an array. */ - $this->withProgressBar( $filtered, function( $file ) use ( &$exportable ) { + $this->withProgressBar( $filtered, function ( $file ) use ( &$exportable ) { $fileContent = Storage::disk( 'ns' )->get( $file ); preg_match_all('/\_\_[m]?\(\s*[\'\"\`]([\w\s\+\"\\/\d\-é&\[\]\@*$#\.\?\%,;)\{\}]*)[\'\"\`]\s*(\,?\s*[\'\"\`]?(\w)*[\'\"\`]?\s*)?\)/', $fileContent, $output_array); @@ -227,7 +227,7 @@ private function extractLocalization( $files ) } }); - return collect( $exportable )->mapWithKeys( function( $exportable ) { + return collect( $exportable )->mapWithKeys( function ( $exportable ) { return [ $exportable[ 'string' ] => $exportable[ 'string' ] ]; })->toArray(); } diff --git a/app/Console/Commands/ModuleSymlinkCommand.php b/app/Console/Commands/ModuleSymlinkCommand.php index 5e226faf3..ce2b39797 100644 --- a/app/Console/Commands/ModuleSymlinkCommand.php +++ b/app/Console/Commands/ModuleSymlinkCommand.php @@ -43,7 +43,7 @@ public function handle() Storage::disk( 'ns' )->deleteDirectory( 'public/modules' ); Storage::disk( 'ns' )->makeDirectory( 'public/modules' ); - $this->withProgressBar( $modules, function( $module ) use ( $moduleService ) { + $this->withProgressBar( $modules, function ( $module ) use ( $moduleService ) { $moduleService->createSymLink( $module[ 'namespace' ] ); }); diff --git a/app/Console/Commands/ModulesMigrateCommand.php b/app/Console/Commands/ModulesMigrateCommand.php index ae014b7db..c9a6c5535 100644 --- a/app/Console/Commands/ModulesMigrateCommand.php +++ b/app/Console/Commands/ModulesMigrateCommand.php @@ -70,7 +70,7 @@ public function handle() ) ); } - $this->withProgressBar( $unmigratedFiles, function( $file ) use ( $module ) { + $this->withProgressBar( $unmigratedFiles, function ( $file ) use ( $module ) { $response = $this->modulesService->runMigration( $module[ 'namespace' ], $file ); AfterMigrationExecutedEvent::dispatch( $module, $response, $file ); }); diff --git a/app/Console/Commands/ProductCommand.php b/app/Console/Commands/ProductCommand.php index e01c7776b..289bf2404 100644 --- a/app/Console/Commands/ProductCommand.php +++ b/app/Console/Commands/ProductCommand.php @@ -68,7 +68,7 @@ private function computeTaxes() */ $taxService = app()->make( TaxService::class ); - $this->withProgressBar( ProductUnitQuantity::with( 'product.tax_group' )->get(), function( ProductUnitQuantity $productUnitQuantity ) use ( $taxService ) { + $this->withProgressBar( ProductUnitQuantity::with( 'product.tax_group' )->get(), function ( ProductUnitQuantity $productUnitQuantity ) use ( $taxService ) { $taxService->computeTax( product: $productUnitQuantity, tax_group_id: $productUnitQuantity->product->tax_group_id, @@ -85,7 +85,7 @@ private function refreshBarcodes() { $queryBuilder = $this->queryBuilder(); - $products = $this->withProgressBar( $queryBuilder->get(), function( $product ) { + $products = $this->withProgressBar( $queryBuilder->get(), function ( $product ) { $this->productService->generateProductBarcode( $product ); }); @@ -105,7 +105,7 @@ private function updateProducts() { $queryBuilder = $this->queryBuilder(); - $this->perform( $queryBuilder, function( $product ) { + $this->perform( $queryBuilder, function ( $product ) { $gallery = ProductGallery::where( 'product_id', $product->id )->get(); $units = ProductUnitQuantity::where( 'product_id', $product->id )->get(); $subItems = ProductSubItem::where( 'product_id', $product->id )->get(); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b639bb95d..22307346e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -37,7 +37,7 @@ protected function schedule(Schedule $schedule) * This could be made through events that are dispatched within * the jobs */ - $schedule->call( function() { + $schedule->call( function () { if ( env( 'TELESCOPE_ENABLED', false ) ) { Artisan::call( 'telescope:prune', [ 'hours' => 12 ]); } @@ -91,7 +91,7 @@ protected function schedule(Schedule $schedule) * We want to make sure Modules Kernel get injected * on the process so that modules jobs can also be scheduled. */ - collect( $modules->getEnabled() )->each( function( $module ) use ( $schedule ) { + collect( $modules->getEnabled() )->each( function ( $module ) use ( $schedule ) { $filePath = $module[ 'path' ] . 'Console' . DIRECTORY_SEPARATOR . 'Kernel.php'; if ( is_file( $filePath ) ) { diff --git a/app/Crud/CashFlowHistoryCrud.php b/app/Crud/CashFlowHistoryCrud.php index e8ef926ca..561a2e2ea 100644 --- a/app/Crud/CashFlowHistoryCrud.php +++ b/app/Crud/CashFlowHistoryCrud.php @@ -439,7 +439,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'cash-flow/history' ), 'create' => ns()->url( 'dashboard/' . 'cash-flow/history/create' ), 'edit' => ns()->url( 'dashboard/' . 'cash-flow/history/edit/' ), diff --git a/app/Crud/CouponCrud.php b/app/Crud/CouponCrud.php index 372a213ee..d8e59168e 100644 --- a/app/Crud/CouponCrud.php +++ b/app/Crud/CouponCrud.php @@ -273,7 +273,7 @@ public function getForm( $entry = null ) */ public function filterPostInputs( $inputs ) { - $inputs = collect( $inputs )->map( function( $field, $key ) { + $inputs = collect( $inputs )->map( function ( $field, $key ) { if ( ( in_array( $key, [ 'minimum_cart_value', 'maximum_cart_value', @@ -286,7 +286,7 @@ public function filterPostInputs( $inputs ) return $field; })->toArray(); - $inputs = collect( $inputs )->filter( function( $field, $key ) { + $inputs = collect( $inputs )->filter( function ( $field, $key ) { if ( ( in_array( $key, [ 'minimum_cart_value', 'maximum_cart_value', @@ -318,7 +318,7 @@ public function filterPostInputs( $inputs ) */ public function filterPutInputs( $inputs, Coupon $entry ) { - $inputs = collect( $inputs )->map( function( $field, $key ) { + $inputs = collect( $inputs )->map( function ( $field, $key ) { if ( ( in_array( $key, [ 'minimum_cart_value', 'maximum_cart_value', @@ -331,7 +331,7 @@ public function filterPutInputs( $inputs, Coupon $entry ) return $field; })->toArray(); - $inputs = collect( $inputs )->filter( function( $field, $key ) { + $inputs = collect( $inputs )->filter( function ( $field, $key ) { if ( ( in_array( $key, [ 'minimum_cart_value', 'maximum_cart_value', @@ -481,13 +481,13 @@ public function beforePut( $inputs, $entry ) */ public function afterPut( $inputs, $coupon ) { - $coupon->categories->each( function( $category ) use ( $inputs ) { + $coupon->categories->each( function ( $category ) use ( $inputs ) { if ( ! in_array( $category->category_id, $inputs[ 'categories' ] ) ) { $category->delete(); } }); - $coupon->products->each( function( $product ) use ( $inputs ) { + $coupon->products->each( function ( $product ) use ( $inputs ) { if ( ! in_array( $product->product_id, $inputs[ 'products' ] ) ) { $product->delete(); } @@ -698,7 +698,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'customers/coupons' ), 'create' => ns()->url( 'dashboard/' . 'customers/coupons/create' ), 'edit' => ns()->url( 'dashboard/' . 'customers/coupons/edit/' ), diff --git a/app/Crud/CustomerAccountCrud.php b/app/Crud/CustomerAccountCrud.php index 2c9409685..6d6e4868a 100644 --- a/app/Crud/CustomerAccountCrud.php +++ b/app/Crud/CustomerAccountCrud.php @@ -224,7 +224,7 @@ public function addFooterSummary( CrudBeforeExportEvent $event ) __( 'Total' ) ); - $totalPositive = collect( $event->entries[ 'data' ] )->map( function( $entry ) { + $totalPositive = collect( $event->entries[ 'data' ] )->map( function ( $entry ) { if ( in_array( $entry->getOriginalValue( 'operation' ), [ CustomerAccountHistory::OPERATION_ADD, CustomerAccountHistory::OPERATION_REFUND, @@ -233,7 +233,7 @@ public function addFooterSummary( CrudBeforeExportEvent $event ) } })->sum(); - $totalNegative = collect( $event->entries[ 'data' ] )->map( function( $entry ) { + $totalNegative = collect( $event->entries[ 'data' ] )->map( function ( $entry ) { if ( in_array( $entry->getOriginalValue( 'operation' ), [ CustomerAccountHistory::OPERATION_DEDUCT, CustomerAccountHistory::OPERATION_PAYMENT, @@ -575,7 +575,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'customers/' . '/account-history' ), 'create' => ns()->url( 'dashboard/' . 'customers/' . '/account-history/create' ), 'edit' => ns()->url( 'dashboard/' . 'customers/' . '/account-history/edit/' ), diff --git a/app/Crud/CustomerCouponCrud.php b/app/Crud/CustomerCouponCrud.php index 46250500a..d7e165bb6 100644 --- a/app/Crud/CustomerCouponCrud.php +++ b/app/Crud/CustomerCouponCrud.php @@ -458,7 +458,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->route( 'ns.dashboard.customers-coupons-generated-list' ), 'create' => '#', // ns()->url( 'dashboard/' . 'customers/' . request()->query( 'customer_id' ) . '/coupons/create' ), 'edit' => ns()->url( 'dashboard/' . 'customers/' . request()->query( 'customer_id' ) . '/coupons/edit/' ), diff --git a/app/Crud/CustomerCrud.php b/app/Crud/CustomerCrud.php index 4cf93b8ad..18d32297c 100644 --- a/app/Crud/CustomerCrud.php +++ b/app/Crud/CustomerCrud.php @@ -374,7 +374,7 @@ public function getForm( Customer $entry = null ) */ public function filterPostInputs( $inputs ) { - return collect( $inputs )->map( function( $value, $key ) { + return collect( $inputs )->map( function ( $value, $key ) { if ( $key === 'group_id' && empty( $value ) ) { $value = $this->options->get( 'ns_customers_default_group', false ); $group = CustomerGroup::find( $value ); @@ -396,7 +396,7 @@ public function filterPostInputs( $inputs ) */ public function filterPutInputs( $inputs, Customer $entry ) { - return collect( $inputs )->map( function( $value, $key ) { + return collect( $inputs )->map( function ( $value, $key ) { if ( $key === 'group_id' && empty( $value ) ) { $value = $this->options->get( 'ns_customers_default_group', false ); $group = CustomerGroup::find( $value ); @@ -685,7 +685,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( '/dashboard/customers' ), 'create' => ns()->url( '/dashboard/customers/create' ), 'edit' => ns()->url( '/dashboard/customers/edit/{id}' ), diff --git a/app/Crud/CustomerGroupCrud.php b/app/Crud/CustomerGroupCrud.php index 1b8bc51d0..8630882a4 100644 --- a/app/Crud/CustomerGroupCrud.php +++ b/app/Crud/CustomerGroupCrud.php @@ -402,7 +402,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/customers/groups' ), 'create' => ns()->url( 'dashboard/customers/groups/create' ), 'edit' => ns()->url( 'dashboard/customers/groups/edit' ), diff --git a/app/Crud/CustomerOrderCrud.php b/app/Crud/CustomerOrderCrud.php index 8e87ccc68..340649f51 100644 --- a/app/Crud/CustomerOrderCrud.php +++ b/app/Crud/CustomerOrderCrud.php @@ -419,7 +419,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'dashboard/customers/orders' ), 'create' => ns()->url( 'dashboard/' . 'dashboard/customers/orders/create' ), 'edit' => ns()->url( 'dashboard/' . 'dashboard/customers/orders/edit/' ), diff --git a/app/Crud/CustomerRewardCrud.php b/app/Crud/CustomerRewardCrud.php index e6dfb4c2e..1658566ed 100644 --- a/app/Crud/CustomerRewardCrud.php +++ b/app/Crud/CustomerRewardCrud.php @@ -420,7 +420,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => 'javascript:void(0)', 'create' => 'javascript:void(0)', 'edit' => ns()->url( 'dashboard/' . $this->getSlug() . '/edit/' ), diff --git a/app/Crud/ExpenseCategoryCrud.php b/app/Crud/ExpenseCategoryCrud.php index ef1f0c517..dc29d762f 100644 --- a/app/Crud/ExpenseCategoryCrud.php +++ b/app/Crud/ExpenseCategoryCrud.php @@ -388,7 +388,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'accounting/accounts' ), 'create' => ns()->url( 'dashboard/' . 'accounting/accounts/create' ), 'edit' => ns()->url( 'dashboard/' . 'accounting/accounts/edit/' ), diff --git a/app/Crud/ExpenseCrud.php b/app/Crud/ExpenseCrud.php index 8cf6025ae..ee4dafa64 100644 --- a/app/Crud/ExpenseCrud.php +++ b/app/Crud/ExpenseCrud.php @@ -514,7 +514,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'expenses' ), 'create' => ns()->url( 'dashboard/' . 'expenses/create' ), 'edit' => ns()->url( 'dashboard/' . 'expenses/edit/{id}' ), diff --git a/app/Crud/GlobalProductHistoryCrud.php b/app/Crud/GlobalProductHistoryCrud.php index c26d71ed0..c5e3aaff7 100644 --- a/app/Crud/GlobalProductHistoryCrud.php +++ b/app/Crud/GlobalProductHistoryCrud.php @@ -488,7 +488,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . '/products/history' ), 'create' => ns()->url( 'dashboard/' . '/products/history/create' ), 'edit' => ns()->url( 'dashboard/' . '/products/history/edit/' ), diff --git a/app/Crud/HoldOrderCrud.php b/app/Crud/HoldOrderCrud.php index 414b41ae4..03c62e69c 100644 --- a/app/Crud/HoldOrderCrud.php +++ b/app/Crud/HoldOrderCrud.php @@ -524,7 +524,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'ns.hold-orders' ), 'create' => ns()->url( 'dashboard/' . 'ns.hold-orders/create' ), 'edit' => ns()->url( 'dashboard/' . 'ns.hold-orders/edit/' ), diff --git a/app/Crud/OrderCrud.php b/app/Crud/OrderCrud.php index 82f9f08b6..f59d8b77e 100644 --- a/app/Crud/OrderCrud.php +++ b/app/Crud/OrderCrud.php @@ -689,7 +689,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => 'ns.orders', 'create' => ns()->route( 'ns.dashboard.pos' ), 'edit' => 'ns.orders/edit/#', diff --git a/app/Crud/OrderInstalmentCrud.php b/app/Crud/OrderInstalmentCrud.php index 1bb9dbeb9..ec3df3059 100644 --- a/app/Crud/OrderInstalmentCrud.php +++ b/app/Crud/OrderInstalmentCrud.php @@ -435,7 +435,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'orders/instalments' ), 'create' => false, 'edit' => ns()->url( 'dashboard/' . 'orders/instalments/edit/' ), diff --git a/app/Crud/PaymentTypeCrud.php b/app/Crud/PaymentTypeCrud.php index c748d2422..3f1e0ad47 100644 --- a/app/Crud/PaymentTypeCrud.php +++ b/app/Crud/PaymentTypeCrud.php @@ -481,7 +481,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'orders/payments-types' ), 'create' => ns()->url( 'dashboard/' . 'orders/payments-types/create' ), 'edit' => ns()->url( 'dashboard/' . 'orders/payments-types/edit/' ), diff --git a/app/Crud/ProcurementCrud.php b/app/Crud/ProcurementCrud.php index 23273e876..3c3959281 100644 --- a/app/Crud/ProcurementCrud.php +++ b/app/Crud/ProcurementCrud.php @@ -519,7 +519,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => 'procurements', 'create' => 'procurements/create', 'edit' => 'procurements/edit', diff --git a/app/Crud/ProcurementProductCrud.php b/app/Crud/ProcurementProductCrud.php index 9e6350774..ac04626bc 100644 --- a/app/Crud/ProcurementProductCrud.php +++ b/app/Crud/ProcurementProductCrud.php @@ -432,7 +432,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'procurements/products' ), 'create' => 'javascript:void(0)', //ns()->url( 'dashboard/' . '/procurements/products/create' ), 'edit' => ns()->url( 'dashboard/' . 'procurements/products/edit/' ), diff --git a/app/Crud/ProductCategoryCrud.php b/app/Crud/ProductCategoryCrud.php index d6a2f40fb..c5fd2b85f 100644 --- a/app/Crud/ProductCategoryCrud.php +++ b/app/Crud/ProductCategoryCrud.php @@ -445,7 +445,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'products/categories' ), 'create' => ns()->url( 'dashboard/' . 'products/categories/create' ), 'edit' => ns()->url( 'dashboard/' . 'products/categories/edit/' ), diff --git a/app/Crud/ProductCrud.php b/app/Crud/ProductCrud.php index f5a6b8855..519409698 100644 --- a/app/Crud/ProductCrud.php +++ b/app/Crud/ProductCrud.php @@ -340,7 +340,7 @@ public function getForm( $entry = null ) [ 'type' => 'hidden', 'name' => 'product_subitems', - 'value' => $entry !== null ? $entry->sub_items()->get()->map( function( $subItem ) { + 'value' => $entry !== null ? $entry->sub_items()->get()->map( function ( $subItem ) { $subItem->load( 'product.unit_quantities.unit' ); return [ @@ -398,8 +398,8 @@ public function getForm( $entry = null ) */ 'groups' => ( $entry instanceof Product ? ProductUnitQuantity::withProduct( $entry->id ) ->get() - ->map( function( $productUnitQuantity ) use ( $fields ) { - return collect( $fields )->map( function( $field ) use ( $productUnitQuantity ) { + ->map( function ( $productUnitQuantity ) use ( $fields ) { + return collect( $fields )->map( function ( $field ) use ( $productUnitQuantity ) { $field[ 'value' ] = $productUnitQuantity->{ $field[ 'name' ] }; return $field; @@ -474,7 +474,7 @@ public function getForm( $entry = null ) 'description' => __( 'Define whether the image should be primary. If there are more than one primary image, one will be chosen for you.' ), ], ], - 'groups' => $entry ? $entry->galleries->map( function( $gallery ) { + 'groups' => $entry ? $entry->galleries->map( function ( $gallery ) { return [ [ 'type' => 'media', @@ -807,7 +807,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'products' ), 'create' => ns()->url( 'dashboard/' . 'products/create' ), 'edit' => ns()->url( 'dashboard/' . 'products/edit/' ), diff --git a/app/Crud/ProductHistoryCrud.php b/app/Crud/ProductHistoryCrud.php index 1c07b9410..a38018b6b 100644 --- a/app/Crud/ProductHistoryCrud.php +++ b/app/Crud/ProductHistoryCrud.php @@ -586,7 +586,7 @@ public function hook( $query ): void */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'products/histories' ), 'create' => false, 'edit' => false, diff --git a/app/Crud/ProductUnitQuantitiesCrud.php b/app/Crud/ProductUnitQuantitiesCrud.php index 7de418bd5..a2d74d652 100644 --- a/app/Crud/ProductUnitQuantitiesCrud.php +++ b/app/Crud/ProductUnitQuantitiesCrud.php @@ -402,7 +402,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => 'javascript:void(0)', // ns()->url( 'dashboard/' . 'products/units' ), 'create' => 'javascript:void(0)', // ns()->url( 'dashboard/' . 'products/units/create' ), 'edit' => 'javascript:void(0)', // ns()->url( 'dashboard/' . 'products/units/edit/' ), diff --git a/app/Crud/ProviderCrud.php b/app/Crud/ProviderCrud.php index 524101cfd..7e889b106 100644 --- a/app/Crud/ProviderCrud.php +++ b/app/Crud/ProviderCrud.php @@ -436,7 +436,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'providers' ), 'create' => ns()->url( 'dashboard/' . 'providers/create' ), 'edit' => ns()->url( 'dashboard/' . 'providers/edit/' ), diff --git a/app/Crud/ProviderProcurementsCrud.php b/app/Crud/ProviderProcurementsCrud.php index b3bde8aa2..1842af431 100644 --- a/app/Crud/ProviderProcurementsCrud.php +++ b/app/Crud/ProviderProcurementsCrud.php @@ -477,7 +477,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . '/providers/procurements' ), 'create' => false, 'edit' => false, diff --git a/app/Crud/ProviderProductsCrud.php b/app/Crud/ProviderProductsCrud.php index e1e8b4068..2c82f831a 100644 --- a/app/Crud/ProviderProductsCrud.php +++ b/app/Crud/ProviderProductsCrud.php @@ -436,7 +436,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . '/dashboard/providers' ), 'create' => false, 'edit' => false, diff --git a/app/Crud/RegisterCrud.php b/app/Crud/RegisterCrud.php index 54c78b8cc..dff5c1a54 100644 --- a/app/Crud/RegisterCrud.php +++ b/app/Crud/RegisterCrud.php @@ -442,7 +442,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'cash-registers' ), 'create' => ns()->url( 'dashboard/' . 'cash-registers/create' ), 'edit' => ns()->url( 'dashboard/' . 'cash-registers/edit/' ), diff --git a/app/Crud/RegisterHistoryCrud.php b/app/Crud/RegisterHistoryCrud.php index ef5d34c84..d8f54f208 100644 --- a/app/Crud/RegisterHistoryCrud.php +++ b/app/Crud/RegisterHistoryCrud.php @@ -509,7 +509,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'registers-history' ), 'create' => false, 'edit' => false, diff --git a/app/Crud/RewardSystemCrud.php b/app/Crud/RewardSystemCrud.php index 2d809cd66..5a35e740f 100644 --- a/app/Crud/RewardSystemCrud.php +++ b/app/Crud/RewardSystemCrud.php @@ -163,8 +163,8 @@ public function getForm( $entry = null ) * this is made to restore rules * by populating the form used for the rules */ - 'rules' => $entry ? ( collect( $entry->rules )->map( function( $rule ) use ( $ruleForm ) { - return collect( $ruleForm )->map( function( $field ) use ( $rule ) { + 'rules' => $entry ? ( collect( $entry->rules )->map( function ( $rule ) use ( $ruleForm ) { + return collect( $ruleForm )->map( function ( $field ) use ( $rule ) { $field[ 'value' ] = $rule[ $field[ 'name' ] ] ?? ''; return $field; @@ -273,9 +273,9 @@ public function afterPut( $request, $entry ) * with their original ID. Those not posted * are deleted. */ - $ids = collect( $rules )->filter( function( $rule ) { + $ids = collect( $rules )->filter( function ( $rule ) { return isset( $rule[ 'id' ] ); - })->map( function( $rule ) { + })->map( function ( $rule ) { return $rule[ 'id' ]; }); @@ -479,7 +479,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => 'ns.rewards_system', 'create' => 'ns.rewards_system/create', 'edit' => 'ns.rewards_system/edit/#', diff --git a/app/Crud/RolesCrud.php b/app/Crud/RolesCrud.php index d491f52da..7c50ead66 100644 --- a/app/Crud/RolesCrud.php +++ b/app/Crud/RolesCrud.php @@ -470,7 +470,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'users/roles' ), 'create' => ns()->url( 'dashboard/' . 'users/roles/create' ), 'edit' => ns()->url( 'dashboard/' . 'users/roles/edit/{id}' ), diff --git a/app/Crud/TaxCrud.php b/app/Crud/TaxCrud.php index cacc1e48a..547ec2c5e 100644 --- a/app/Crud/TaxCrud.php +++ b/app/Crud/TaxCrud.php @@ -422,7 +422,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'taxes' ), 'create' => ns()->url( 'dashboard/' . 'taxes/create' ), 'edit' => ns()->url( 'dashboard/' . 'taxes/edit/' ), diff --git a/app/Crud/TaxesGroupCrud.php b/app/Crud/TaxesGroupCrud.php index d2ce40c57..92b81688b 100644 --- a/app/Crud/TaxesGroupCrud.php +++ b/app/Crud/TaxesGroupCrud.php @@ -360,7 +360,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'taxes/groups' ), 'create' => ns()->url( 'dashboard/' . 'taxes/groups/create' ), 'edit' => ns()->url( 'dashboard/' . 'taxes/groups/edit/{id}' ), diff --git a/app/Crud/UnitCrud.php b/app/Crud/UnitCrud.php index 25b89699a..45992c5e3 100644 --- a/app/Crud/UnitCrud.php +++ b/app/Crud/UnitCrud.php @@ -416,7 +416,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'units' ), 'create' => ns()->url( 'dashboard/' . 'units/create' ), 'edit' => ns()->url( 'dashboard/' . 'units/edit/' ), diff --git a/app/Crud/UnitGroupCrud.php b/app/Crud/UnitGroupCrud.php index 19f003b44..aecc4f57d 100644 --- a/app/Crud/UnitGroupCrud.php +++ b/app/Crud/UnitGroupCrud.php @@ -362,7 +362,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'units/groups' ), 'create' => ns()->url( 'dashboard/' . 'units/groups/create' ), 'edit' => ns()->url( 'dashboard/' . 'units/groups/edit/' ), diff --git a/app/Crud/UserCrud.php b/app/Crud/UserCrud.php index 71e4fc8b0..83028db24 100644 --- a/app/Crud/UserCrud.php +++ b/app/Crud/UserCrud.php @@ -480,7 +480,7 @@ public function bulkAction( Request $request ) */ public function getLinks(): array { - return [ + return [ 'list' => ns()->url( 'dashboard/' . 'users' ), 'create' => ns()->url( 'dashboard/' . 'users/create' ), 'edit' => ns()->url( 'dashboard/' . 'users/edit/' ), diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 1ce528539..86951f648 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -150,7 +150,7 @@ public function render($request, Throwable $exception) ], ]); - $exceptionResponse = $exceptions->map( function( $exceptionConfig, $class ) use ( $exception, $request ) { + $exceptionResponse = $exceptions->map( function ( $exceptionConfig, $class ) use ( $exception, $request ) { if ( $exception instanceof $class ) { if ( $request->expectsJson() ) { Log::error( $exception->getMessage() ); diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.php index e906cea5a..be3425676 100644 --- a/app/Exceptions/ValidationException.php +++ b/app/Exceptions/ValidationException.php @@ -43,8 +43,8 @@ private function toHumanError() if ( $this->validator ) { $errors = $this->errors(); - $errors = collect( $errors )->map( function( $messages ) { - return collect( $messages )->map( function( $message ) { + $errors = collect( $errors )->map( function ( $messages ) { + return collect( $messages )->map( function ( $message ) { switch ( $message ) { case 'validation.unique' : return __( 'This value is already in use on the database.' ); case 'validation.required' : return __( 'This field is required.' ); diff --git a/app/Fields/OrderPaymentFields.php b/app/Fields/OrderPaymentFields.php index 3681d6367..754d9ffed 100644 --- a/app/Fields/OrderPaymentFields.php +++ b/app/Fields/OrderPaymentFields.php @@ -18,7 +18,7 @@ public function get() 'validation' => 'required', 'name' => 'identifier', 'type' => 'select', - 'options' => collect( PaymentType::active()->get() )->map( function( $payment ) { + 'options' => collect( PaymentType::active()->get() )->map( function ( $payment ) { $payment[ 'value' ] = $payment[ 'identifier' ]; return $payment; diff --git a/app/Fields/ProcurementFields.php b/app/Fields/ProcurementFields.php index 6c360521b..10abe61b3 100644 --- a/app/Fields/ProcurementFields.php +++ b/app/Fields/ProcurementFields.php @@ -33,7 +33,7 @@ public function get( Procurement $model = null ) * let's populate the value * using a clear method */ - return collect([ $name, $description, $provider_id ])->map( function( $field ) use ( $model ) { + return collect([ $name, $description, $provider_id ])->map( function ( $field ) use ( $model ) { $field->value = $this->__getValue( $model, $field->name ); return $field; diff --git a/app/Fields/UnitsFields.php b/app/Fields/UnitsFields.php index 8342e4336..e32f117a9 100644 --- a/app/Fields/UnitsFields.php +++ b/app/Fields/UnitsFields.php @@ -46,7 +46,7 @@ public function get( Unit $model = null ) * let's populate the value * using a clear method */ - return collect([ $name, $description, $group_id, $value, $base_unit ])->map( function( $field ) use ( $model ) { + return collect([ $name, $description, $group_id, $value, $base_unit ])->map( function ( $field ) use ( $model ) { $field->value = $this->__getValue( $model, $field->name ); return $field; diff --git a/app/Fields/UnitsGroupsFields.php b/app/Fields/UnitsGroupsFields.php index 22cb5897f..0e48449c4 100644 --- a/app/Fields/UnitsGroupsFields.php +++ b/app/Fields/UnitsGroupsFields.php @@ -27,7 +27,7 @@ public function get( UnitGroup $model = null ) * let's populate the value * using a clear method */ - return collect([ $name, $description ])->map( function( $field ) use ( $model ) { + return collect([ $name, $description ])->map( function ( $field ) use ( $model ) { $field->value = $this->__getValue( $model, $field->name ); return $field; diff --git a/app/Forms/ProcurementForm.php b/app/Forms/ProcurementForm.php index 197b186ad..f0a8c1bad 100644 --- a/app/Forms/ProcurementForm.php +++ b/app/Forms/ProcurementForm.php @@ -60,7 +60,7 @@ public function __construct() 'type' => 'currency', ], ]), - 'products' => isset( $procurement ) ? $procurement->products->map( function( $_product ) { + 'products' => isset( $procurement ) ? $procurement->products->map( function ( $_product ) { $product = Product::findOrFail( $_product->product_id ); $product->load( 'unit_quantities.unit' )->get(); diff --git a/app/Forms/UserProfileForm.php b/app/Forms/UserProfileForm.php index 967e5bb2a..fd5e0baa6 100644 --- a/app/Forms/UserProfileForm.php +++ b/app/Forms/UserProfileForm.php @@ -109,7 +109,7 @@ public function processCredentials( $request, $validator ) if ( ! Hash::check( $request->input( 'security.old_password' ), Auth::user()->password ) ) { $validator->errors()->add( 'security.old_password', __( 'Wrong password provided' ) ); - return [ + return [ 'status' => 'failed', 'message' => __( 'Wrong old password provided' ), ]; diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index e78d154ab..448be5a81 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -313,7 +313,7 @@ public function postSignUp( SignUpRequest $request ) * The administrator might be aware * of the user having created their account. */ - Role::namespace( 'admin' )->users->each( function( $admin ) use ( $user ) { + Role::namespace( 'admin' )->users->each( function ( $admin ) use ( $user ) { Mail::to( $admin->email ) ->queue( new UserRegisteredMail( $admin, $user ) ); }); diff --git a/app/Http/Controllers/Dashboard/CashRegistersController.php b/app/Http/Controllers/Dashboard/CashRegistersController.php index 9767accd8..b3ba022ce 100644 --- a/app/Http/Controllers/Dashboard/CashRegistersController.php +++ b/app/Http/Controllers/Dashboard/CashRegistersController.php @@ -55,7 +55,7 @@ public function getRegisters( $register_id = null ) return $register; } - return Register::get()->map( function( $register ) { + return Register::get()->map( function ( $register ) { $this->registersService->getRegisterDetails( $register ); return $register; @@ -136,7 +136,7 @@ public function getSessionHistory( Register $register ) ->where( 'id', '>=', $lastOpening->id ) ->get(); - $actions->each( function( $session ) { + $actions->each( function ( $session ) { switch ( $session->action ) { case RegisterHistory::ACTION_CASHING: $session->label = __( 'Cash In' ); diff --git a/app/Http/Controllers/Dashboard/CategoryController.php b/app/Http/Controllers/Dashboard/CategoryController.php index caf4e9098..c1480f421 100644 --- a/app/Http/Controllers/Dashboard/CategoryController.php +++ b/app/Http/Controllers/Dashboard/CategoryController.php @@ -253,7 +253,7 @@ public function getCategories( $id = '0' ) ->onSale() ->trackingDisabled() ->get() - ->map( function( $product ) { + ->map( function ( $product ) { if ( $product->unit_quantities()->count() === 1 ) { $product->load( 'unit_quantities.unit' ); } @@ -273,7 +273,7 @@ public function getCategories( $id = '0' ) 'products' => [], 'previousCategory' => false, 'currentCategory' => false, - 'categories' => ProductCategory::where(function( $query ) { + 'categories' => ProductCategory::where(function ( $query ) { $query->where( 'parent_id', null ) ->orWhere( 'parent_id', 0 ); }) diff --git a/app/Http/Controllers/Dashboard/CrudController.php b/app/Http/Controllers/Dashboard/CrudController.php index 4715e2bea..315466999 100644 --- a/app/Http/Controllers/Dashboard/CrudController.php +++ b/app/Http/Controllers/Dashboard/CrudController.php @@ -25,7 +25,7 @@ class CrudController extends DashboardController { public function __construct() { - $this->middleware( function( $request, $next ) { + $this->middleware( function ( $request, $next ) { return $next( $request ); }); } diff --git a/app/Http/Controllers/Dashboard/CustomersController.php b/app/Http/Controllers/Dashboard/CustomersController.php index 689400303..9f95c1027 100644 --- a/app/Http/Controllers/Dashboard/CustomersController.php +++ b/app/Http/Controllers/Dashboard/CustomersController.php @@ -161,7 +161,7 @@ public function getOrders( $id ) ->orders() ->orderBy( 'created_at', 'desc' ) ->get() - ->map( function( Order $order ) { + ->map( function ( Order $order ) { switch ( $order->payment_status ) { case Order::PAYMENT_HOLD : $order->human_status = __( 'Hold' ); break; diff --git a/app/Http/Controllers/Dashboard/CustomersGroupsController.php b/app/Http/Controllers/Dashboard/CustomersGroupsController.php index de27e71c7..c897b214d 100644 --- a/app/Http/Controllers/Dashboard/CustomersGroupsController.php +++ b/app/Http/Controllers/Dashboard/CustomersGroupsController.php @@ -166,7 +166,7 @@ public function transferOwnership( Request $request ) $customers = Customer::where( 'group_id', $fromModel->id ) ->get(); $customers - ->forEach( function( $customer ) use ( $toModel ) { + ->forEach( function ( $customer ) use ( $toModel ) { $customer->group_id = $toModel->id; $customer->save(); }); @@ -185,7 +185,7 @@ public function transferOwnership( Request $request ) $customer = Customer::where( 'id', $customerID ) ->where( 'group_id', $fromModel->id ) ->get() - ->forEach( function( $customer ) use ( $toModel ) { + ->forEach( function ( $customer ) use ( $toModel ) { $customer->group_id = $toModel->id; $customer->save(); }); diff --git a/app/Http/Controllers/Dashboard/ModulesController.php b/app/Http/Controllers/Dashboard/ModulesController.php index d738449e6..bf1dd4802 100644 --- a/app/Http/Controllers/Dashboard/ModulesController.php +++ b/app/Http/Controllers/Dashboard/ModulesController.php @@ -29,7 +29,7 @@ public function __construct( ) { parent::__construct(); - $this->middleware( function( $request, $next ) { + $this->middleware( function ( $request, $next ) { ns()->restrict([ 'manage.modules' ]); return $next( $request ); diff --git a/app/Http/Controllers/Dashboard/OrdersController.php b/app/Http/Controllers/Dashboard/OrdersController.php index cf76bba2d..19bb4db74 100644 --- a/app/Http/Controllers/Dashboard/OrdersController.php +++ b/app/Http/Controllers/Dashboard/OrdersController.php @@ -47,11 +47,11 @@ public function __construct( $this->optionsService = $options; $this->ordersService = $ordersService; - $this->middleware( function( $request, $next ) { + $this->middleware( function ( $request, $next ) { $this->paymentTypes = PaymentType::orderBy( 'priority', 'asc' ) ->active() ->get() - ->map( function( $payment, $index ) { + ->map( function ( $payment, $index ) { $payment->selected = $index === 0; return $payment; @@ -92,7 +92,7 @@ public function getOrderPaymentReceipt( OrderPayment $orderPayment, Request $req return $this->view( 'pages.dashboard.orders.templates.payment-receipt', [ 'payment' => $orderPayment, 'order' => $order, - 'paymentTypes' => collect( $this->paymentTypes )->mapWithKeys( function( $payment ) { + 'paymentTypes' => collect( $this->paymentTypes )->mapWithKeys( function ( $payment ) { return [ $payment[ 'identifier' ] => $payment[ 'label' ] ]; }), 'ordersService' => app()->make( OrdersService::class ), @@ -180,7 +180,7 @@ public function showPOS() ns()->option->get( 'ns_store_name', 'NexoPOS' ) ), 'orderTypes' => collect( $this->ordersService->getTypeOptions() ) - ->filter( function( $type, $label ) { + ->filter( function ( $type, $label ) { return in_array( $label, ns()->option->get( 'ns_pos_order_types' ) ?: [] ); }), 'options' => Hook::filter( 'ns-pos-options', [ @@ -276,7 +276,7 @@ public function orderReceipt( Order $order ) 'title' => sprintf( __( 'Order Receipt — %s' ), $order->code ), 'optionsService' => $this->optionsService, 'ordersService' => $this->ordersService, - 'paymentTypes' => collect( $this->paymentTypes )->mapWithKeys( function( $payment ) { + 'paymentTypes' => collect( $this->paymentTypes )->mapWithKeys( function ( $payment ) { return [ $payment[ 'identifier' ] => $payment[ 'label' ] ]; }), ]); diff --git a/app/Http/Controllers/Dashboard/ProcurementController.php b/app/Http/Controllers/Dashboard/ProcurementController.php index e8eb94550..a2f83b973 100644 --- a/app/Http/Controllers/Dashboard/ProcurementController.php +++ b/app/Http/Controllers/Dashboard/ProcurementController.php @@ -120,7 +120,7 @@ public function resetProcurement( $procurement_id ) */ public function procurementProducts( $procurement_id ) { - return $this->procurementService->getProducts( $procurement_id )->map( function( $product ) { + return $this->procurementService->getProducts( $procurement_id )->map( function ( $product ) { $product->unit; return $product; @@ -300,19 +300,19 @@ public function searchProcurementProduct( Request $request ) $products = Product::query() ->trackingDisabled() ->with( 'unit_quantities.unit' ) - ->where( function( $query ) use ( $request ) { + ->where( function ( $query ) use ( $request ) { $query->where( 'sku', 'LIKE', "%{$request->input( 'argument' )}%" ) ->orWhere( 'name', 'LIKE', "%{$request->input( 'argument' )}%" ) ->orWhere( 'barcode', 'LIKE', "%{$request->input( 'argument' )}%" ); }) ->limit( 8 ) ->get() - ->map( function( $product ) { + ->map( function ( $product ) { $units = json_decode( $product->purchase_unit_ids ); if ( $units ) { $product->purchase_units = collect(); - collect( $units )->each( function( $unitID ) use ( &$product ) { + collect( $units )->each( function ( $unitID ) use ( &$product ) { $product->purchase_units->push( Unit::find( $unitID ) ); }); } diff --git a/app/Http/Controllers/Dashboard/ProductsController.php b/app/Http/Controllers/Dashboard/ProductsController.php index 476515aa0..8cf95b2df 100644 --- a/app/Http/Controllers/Dashboard/ProductsController.php +++ b/app/Http/Controllers/Dashboard/ProductsController.php @@ -305,7 +305,7 @@ public function deleteSingleVariation( $product_id, int $variation_id ) /** @var Product */ $product = $this->singleProduct( $product_id ); - $results = $product->variations->map( function( $variation ) use ( $variation_id ) { + $results = $product->variations->map( function ( $variation ) use ( $variation_id ) { if ( $variation->id === $variation_id ) { $variation->delete(); @@ -315,7 +315,7 @@ public function deleteSingleVariation( $product_id, int $variation_id ) return 0; }); - $opResult = $results->reduce( function( $before, $after ) { + $opResult = $results->reduce( function ( $before, $after ) { return $before + $after; }); @@ -357,7 +357,7 @@ public function listProducts() { ns()->restrict([ 'nexopos.read.products' ]); - Hook::addFilter( 'ns-crud-footer', function( Output $output ) { + Hook::addFilter( 'ns-crud-footer', function ( Output $output ) { $output->addView( 'pages.dashboard.products.quantity-popup' ); return $output; @@ -423,7 +423,7 @@ public function productUnits( Product $product ) */ public function productHistory( $identifier ) { - Hook::addFilter( 'ns-crud-footer', function( Output $output, $identifier ) { + Hook::addFilter( 'ns-crud-footer', function ( Output $output, $identifier ) { $output->addView( 'pages.dashboard.products.history' ); return $output; @@ -620,7 +620,7 @@ public function printLabels() public function getProcuredProducts( Product $product ) { - return $product->procurementHistory->map( function( $procurementProduct ) { + return $product->procurementHistory->map( function ( $procurementProduct ) { $procurementProduct->procurement = $procurementProduct->procurement()->select( 'name' )->first(); return $procurementProduct; diff --git a/app/Http/Controllers/Dashboard/ReportsController.php b/app/Http/Controllers/Dashboard/ReportsController.php index fc0b16d8f..41b70baa7 100644 --- a/app/Http/Controllers/Dashboard/ReportsController.php +++ b/app/Http/Controllers/Dashboard/ReportsController.php @@ -100,11 +100,11 @@ public function getSoldStockReport( Request $request ) $request->input( 'endDate' ) ); - return collect( $orders )->mapToGroups( function( $product ) { + return collect( $orders )->mapToGroups( function ( $product ) { return [ $product->product_id . '-' . $product->unit_id => $product, ]; - })->map( function( $groups ) { + })->map( function ( $groups ) { return [ 'name' => $groups->first()->name, 'unit_name' => $groups->first()->unit_name, @@ -128,33 +128,33 @@ public function getCashFlow( Request $request ) $entries = $this->reportService->getFromTimeRange( $rangeStarts, $rangeEnds ); $total = $entries->count() > 0 ? $entries->first()->toArray() : []; $creditCashFlow = AccountType::where( 'operation', CashFlow::OPERATION_CREDIT )->with([ - 'cashFlowHistories' => function( $query ) use ( $rangeStarts, $rangeEnds ) { + 'cashFlowHistories' => function ( $query ) use ( $rangeStarts, $rangeEnds ) { $query->where( 'created_at', '>=', $rangeStarts ) ->where( 'created_at', '<=', $rangeEnds ); }, ]) ->get() - ->map( function( $accountType ) { + ->map( function ( $accountType ) { $accountType->total = $accountType->cashFlowHistories->count() > 0 ? $accountType->cashFlowHistories->sum( 'value' ) : 0; return $accountType; }); $debitCashFlow = AccountType::where( 'operation', CashFlow::OPERATION_DEBIT )->with([ - 'cashFlowHistories' => function( $query ) use ( $rangeStarts, $rangeEnds ) { + 'cashFlowHistories' => function ( $query ) use ( $rangeStarts, $rangeEnds ) { $query->where( 'created_at', '>=', $rangeStarts ) ->where( 'created_at', '<=', $rangeEnds ); }, ]) ->get() - ->map( function( $accountType ) { + ->map( function ( $accountType ) { $accountType->total = $accountType->cashFlowHistories->count() > 0 ? $accountType->cashFlowHistories->sum( 'value' ) : 0; return $accountType; }); return [ - 'summary' => collect( $total )->mapWithKeys( function( $value, $key ) use ( $entries ) { + 'summary' => collect( $total )->mapWithKeys( function ( $value, $key ) use ( $entries ) { if ( ! in_array( $key, [ 'range_starts', 'range_ends', 'day_of_year' ] ) ) { return [ $key => $entries->sum( $key ) ]; } @@ -192,11 +192,11 @@ public function getProfit( Request $request ) return $orders; - return collect( $orders )->mapToGroups( function( $product ) { + return collect( $orders )->mapToGroups( function ( $product ) { return [ $product->product_id . '-' . $product->unit_id => $product, ]; - })->map( function( $groups ) { + })->map( function ( $groups ) { return [ 'name' => $groups->first()->name, 'unit_name' => $groups->first()->unit_name, diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 5539a856d..5b7933d6d 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -84,7 +84,7 @@ public function getBestCashiers() */ public function hookOutput( $name ) { - Hook::addAction( 'ns-dashboard-footer', function( Output $output ) use ( $name ) { + Hook::addAction( 'ns-dashboard-footer', function ( Output $output ) use ( $name ) { Hook::action( $name, $output ); }, 15 ); } @@ -130,7 +130,7 @@ public function getWeekReports() DashboardDay::from( $currentWeekStarts->toDateTimeString() ) ->to( $currentWeekEnds->toDateTimeString() ) ->get() - ->each( function( $report ) use ( &$weekMap ) { + ->each( function ( $report ) use ( &$weekMap ) { if ( ! isset( $weekMap[ Carbon::parse( $report->range_starts )->dayOfWeek ][ 'current' ][ 'entries' ] ) ) { $weekMap[ Carbon::parse( $report->range_starts )->dayOfWeek ][ 'current' ][ 'entries' ] = []; } @@ -141,7 +141,7 @@ public function getWeekReports() DashboardDay::from( $lastWeekStarts->toDateTimeString() ) ->to( $lastWeekEnds->toDateTimeString() ) ->get() - ->each( function( $report ) use ( &$weekMap ) { + ->each( function ( $report ) use ( &$weekMap ) { if ( ! isset( $weekMap[ Carbon::parse( $report->range_starts )->dayOfWeek ][ 'previous' ][ 'entries' ] ) ) { $weekMap[ Carbon::parse( $report->range_starts )->dayOfWeek ][ 'previous' ][ 'entries' ] = []; } diff --git a/app/Http/Middleware/FooterOutputHookMiddleware.php b/app/Http/Middleware/FooterOutputHookMiddleware.php index 4d7863008..d4e0d3348 100644 --- a/app/Http/Middleware/FooterOutputHookMiddleware.php +++ b/app/Http/Middleware/FooterOutputHookMiddleware.php @@ -17,7 +17,7 @@ class FooterOutputHookMiddleware */ public function handle(Request $request, Closure $next) { - Hook::addAction( 'ns-dashboard-footer', function( Output $output ) { + Hook::addAction( 'ns-dashboard-footer', function ( Output $output ) { $exploded = explode( '.', request()->route()->getName() ); /** diff --git a/app/Http/Requests/CrudPostRequest.php b/app/Http/Requests/CrudPostRequest.php index 9449a47e3..52d73e26d 100644 --- a/app/Http/Requests/CrudPostRequest.php +++ b/app/Http/Requests/CrudPostRequest.php @@ -46,7 +46,7 @@ public function rules() /** * Let's properly flat everything. */ - $flatRules = collect( $isolatedRules )->mapWithKeys( function( $rule ) { + $flatRules = collect( $isolatedRules )->mapWithKeys( function ( $rule ) { return [ $rule[0] => $rule[1] ]; })->toArray(); diff --git a/app/Http/Requests/CrudPutRequest.php b/app/Http/Requests/CrudPutRequest.php index 46fcb2501..94ae13c0d 100644 --- a/app/Http/Requests/CrudPutRequest.php +++ b/app/Http/Requests/CrudPutRequest.php @@ -47,7 +47,7 @@ public function rules() * This will flat the rules to create a dot-like * validation rules array */ - $flatRules = collect( $isolatedRules )->mapWithKeys( function( $rule ) { + $flatRules = collect( $isolatedRules )->mapWithKeys( function ( $rule ) { return [ $rule[0] => $rule[1] ]; })->toArray(); diff --git a/app/Jobs/ClearHoldOrdersJob.php b/app/Jobs/ClearHoldOrdersJob.php index 5bf9e2cfe..1619eec2d 100644 --- a/app/Jobs/ClearHoldOrdersJob.php +++ b/app/Jobs/ClearHoldOrdersJob.php @@ -54,7 +54,7 @@ public function handle() $deleted = Order::paymentStatus( Order::PAYMENT_HOLD ) ->get() - ->filter( function( $order ) use ( $options, $date ) { + ->filter( function ( $order ) use ( $options, $date ) { /** * @var Carbon */ diff --git a/app/Listeners/ProductBeforeDeleteEventListener.php b/app/Listeners/ProductBeforeDeleteEventListener.php index 82ae5232c..52852bfa3 100644 --- a/app/Listeners/ProductBeforeDeleteEventListener.php +++ b/app/Listeners/ProductBeforeDeleteEventListener.php @@ -38,7 +38,7 @@ public function handle(ProductBeforeDeleteEvent $event) */ $this->productService->resetProduct( $event->product ); - $this->productService->getProductVariations( $event->product )->each( function( $variation ) { + $this->productService->getProductVariations( $event->product )->each( function ( $variation ) { /** * deleting a variation * could also trigger the same product event diff --git a/app/Models/CustomerBillingAddress.php b/app/Models/CustomerBillingAddress.php index 2f5330a78..aa16e61a4 100644 --- a/app/Models/CustomerBillingAddress.php +++ b/app/Models/CustomerBillingAddress.php @@ -11,15 +11,15 @@ class CustomerBillingAddress extends CustomerAddress protected static function booted() { - static::addGlobalScope( 'type', function( Builder $builder ) { + static::addGlobalScope( 'type', function ( Builder $builder ) { $builder->where( 'type', 'billing' ); }); - static::creating( function( $address ) { + static::creating( function ( $address ) { $address->type = 'billing'; }); - static::updating( function( $address ) { + static::updating( function ( $address ) { $address->type = 'billing'; }); } diff --git a/app/Models/CustomerShippingAddress.php b/app/Models/CustomerShippingAddress.php index 57b0a9086..08d0ce501 100644 --- a/app/Models/CustomerShippingAddress.php +++ b/app/Models/CustomerShippingAddress.php @@ -11,15 +11,15 @@ class CustomerShippingAddress extends CustomerAddress protected static function booted() { - static::addGlobalScope( 'type', function( Builder $builder ) { + static::addGlobalScope( 'type', function ( Builder $builder ) { $builder->where( 'type', 'shipping' ); }); - static::creating( function( $address ) { + static::creating( function ( $address ) { $address->type = 'shipping'; }); - static::updating( function( $address ) { + static::updating( function ( $address ) { $address->type = 'shipping'; }); } diff --git a/app/Models/Order.php b/app/Models/Order.php index 13f6bd0ce..c0f044541 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -234,7 +234,7 @@ public function getCombinedProductsAttribute() if ( ns()->option->get( 'ns_invoice_merge_similar_products', 'no' ) === 'yes' ) { $combinaison = []; - $this->products()->with( 'unit' )->get()->each( function( $product ) use ( &$combinaison ) { + $this->products()->with( 'unit' )->get()->each( function ( $product ) use ( &$combinaison ) { $values = $product->toArray(); extract( $values ); diff --git a/app/Models/OrderBillingAddress.php b/app/Models/OrderBillingAddress.php index 26f70ac37..4020a2562 100644 --- a/app/Models/OrderBillingAddress.php +++ b/app/Models/OrderBillingAddress.php @@ -13,15 +13,15 @@ class OrderBillingAddress extends NsModel protected static function booted() { - static::addGlobalScope( 'type', function( Builder $builder ) { + static::addGlobalScope( 'type', function ( Builder $builder ) { $builder->where( 'type', 'billing' ); }); - static::creating( function( $address ) { + static::creating( function ( $address ) { $address->type = 'billing'; }); - static::updating( function( $address ) { + static::updating( function ( $address ) { $address->type = 'billing'; }); } diff --git a/app/Models/OrderPayment.php b/app/Models/OrderPayment.php index ec4162b5d..f2915d5af 100644 --- a/app/Models/OrderPayment.php +++ b/app/Models/OrderPayment.php @@ -42,8 +42,8 @@ public function type() public function getPaymentLabelAttribute() { - $paymentTypes = Cache::remember( 'nexopos.pos.payments-key', '3600', function() { - return PaymentType::active()->get()->mapWithKeys( function( $paymentType ) { + $paymentTypes = Cache::remember( 'nexopos.pos.payments-key', '3600', function () { + return PaymentType::active()->get()->mapWithKeys( function ( $paymentType ) { return [ $paymentType->identifier => $paymentType->label ]; }); }); diff --git a/app/Models/OrderShippingAddress.php b/app/Models/OrderShippingAddress.php index da82a4e54..af75e496e 100644 --- a/app/Models/OrderShippingAddress.php +++ b/app/Models/OrderShippingAddress.php @@ -13,15 +13,15 @@ class OrderShippingAddress extends NsModel protected static function booted() { - static::addGlobalScope( 'type', function( Builder $builder ) { + static::addGlobalScope( 'type', function ( Builder $builder ) { $builder->where( 'type', 'shipping' ); }); - static::creating( function( $address ) { + static::creating( function ( $address ) { $address->type = 'shipping'; }); - static::updating( function( $address ) { + static::updating( function ( $address ) { $address->type = 'shipping'; }); } diff --git a/app/Models/Role.php b/app/Models/Role.php index 5ec8d73e1..67b8a6d92 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -154,7 +154,7 @@ public function addPermissions( $permissions, $silent = false ) * looping over provided permissions * and attempt to create a relation */ - $permissions->each( function( $permissionNamespace ) { + $permissions->each( function ( $permissionNamespace ) { $this->addPermissions( $permissionNamespace ); }); } elseif ( is_array( $permissions ) ) { @@ -162,7 +162,7 @@ public function addPermissions( $permissions, $silent = false ) * looping over provided permissions * and attempt to create a relation */ - collect( $permissions )->each( function( $permissionNamespace ) { + collect( $permissions )->each( function ( $permissionNamespace ) { $this->addPermissions( $permissionNamespace ); }); } elseif ( $permissions instanceof Permission ) { diff --git a/app/Models/RolePermission.php b/app/Models/RolePermission.php index ab3a45237..05eecae5e 100644 --- a/app/Models/RolePermission.php +++ b/app/Models/RolePermission.php @@ -13,4 +13,4 @@ class RolePermission extends NsRootModel public $timestamps = false; public $incrementing = false; -} \ No newline at end of file +} diff --git a/app/Models/User.php b/app/Models/User.php index de03c9d67..2983b3432 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -157,7 +157,7 @@ public static function permissions( $user_id = null ) } } - return collect( self::$permissions )->filter( function( $permission, $key ) use ( $roles_id ) { + return collect( self::$permissions )->filter( function ( $permission, $key ) use ( $roles_id ) { return in_array( $key, $roles_id ); }) ->flatten() diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a151fbabf..aa786dfcb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -51,19 +51,19 @@ public function register() { include_once base_path() . '/app/Services/HelperFunctions.php'; - $this->app->singleton( Options::class, function() { + $this->app->singleton( Options::class, function () { return new Options; }); - $this->app->singleton( MenuService::class, function() { + $this->app->singleton( MenuService::class, function () { return new MenuService; }); - $this->app->singleton( UpdateService::class, function() { + $this->app->singleton( UpdateService::class, function () { return new UpdateService; }); - $this->app->bind( DemoService::class, function() { + $this->app->bind( DemoService::class, function () { return new DemoService( app()->make( ProductCategoryService::class ), app()->make( ProductService::class ), @@ -73,7 +73,7 @@ public function register() }); // save Singleton for options - $this->app->singleton( DateService::class, function() { + $this->app->singleton( DateService::class, function () { $options = app()->make( Options::class ); $timeZone = $options->get( 'ns_datetime_timezone', 'Europe/London' ); @@ -81,16 +81,16 @@ public function register() }); // save Singleton for options - $this->app->singleton( UserOptions::class, function() { + $this->app->singleton( UserOptions::class, function () { return new UserOptions( Auth::id() ); }); - $this->app->singleton( CashRegistersService::class, function() { + $this->app->singleton( CashRegistersService::class, function () { return new CashRegistersService; }); // save Singleton for options - $this->app->singleton( Users::class, function() { + $this->app->singleton( Users::class, function () { return new Users( Auth::check() ? Auth::user()->roles : collect([]), Auth::user(), @@ -99,31 +99,31 @@ public function register() }); // provide media manager - $this->app->singleton( MediaService::class, function() { + $this->app->singleton( MediaService::class, function () { return new MediaService([ 'extensions' => [ 'jpg', 'jpeg', 'png', 'gif', 'zip', 'docx', 'txt' ], ]); }); - $this->app->singleton( CrudService::class, function() { + $this->app->singleton( CrudService::class, function () { return new CrudService; }); - $this->app->singleton( BarcodeService::class, function() { + $this->app->singleton( BarcodeService::class, function () { return new BarcodeService; }); - $this->app->singleton( ResetService::class, function() { + $this->app->singleton( ResetService::class, function () { return new ResetService; }); - $this->app->bind( ReportService::class, function() { + $this->app->bind( ReportService::class, function () { return new ReportService( app()->make( DateService::class ) ); }); - $this->app->singleton( CoreService::class, function() { + $this->app->singleton( CoreService::class, function () { return new CoreService( app()->make( CurrencyService::class ), app()->make( UpdateService::class ), @@ -136,17 +136,17 @@ public function register() ); }); - $this->app->bind( ProductCategoryService::class, function( $app ) { + $this->app->bind( ProductCategoryService::class, function ( $app ) { return new ProductCategoryService; }); - $this->app->bind( TaxService::class, function( $app ) { + $this->app->bind( TaxService::class, function ( $app ) { return new TaxService( $app->make( CurrencyService::class ) ); }); - $this->app->bind( CurrencyService::class, function( $app ) { + $this->app->bind( CurrencyService::class, function ( $app ) { $options = app()->make( Options::class ); return new CurrencyService( @@ -162,7 +162,7 @@ public function register() ); }); - $this->app->bind( ProductService::class, function( $app ) { + $this->app->bind( ProductService::class, function ( $app ) { return new ProductService( $app->make( ProductCategoryService::class ), $app->make( TaxService::class ), @@ -172,31 +172,31 @@ public function register() ); }); - $this->app->singleton( Validation::class, function( $app ) { + $this->app->singleton( Validation::class, function ( $app ) { return new Validation; }); - $this->app->bind( UnitService::class, function( $app ) { + $this->app->bind( UnitService::class, function ( $app ) { return new UnitService( $app->make( CurrencyService::class ) ); }); - $this->app->singleton( ProviderService::class, function( $app ) { + $this->app->singleton( ProviderService::class, function ( $app ) { return new ProviderService; }); - $this->app->singleton( CustomerService::class, function( $app ) { + $this->app->singleton( CustomerService::class, function ( $app ) { return new CustomerService; }); - $this->app->bind( ExpenseService::class, function( $app ) { + $this->app->bind( ExpenseService::class, function ( $app ) { return new ExpenseService( app()->make( DateService::class ) ); }); - $this->app->bind( OrdersService::class, function( $app ) { + $this->app->bind( OrdersService::class, function ( $app ) { return new OrdersService( customerService: $app->make( CustomerService::class ), productService: $app->make( ProductService::class ), @@ -210,7 +210,7 @@ public function register() ); }); - $this->app->bind( ProcurementService::class, function( $app ) { + $this->app->bind( ProcurementService::class, function ( $app ) { return new ProcurementService( $app->make( ProviderService::class ), $app->make( UnitService::class ), @@ -225,7 +225,7 @@ public function register() * When the module has started, * we can load the configuration. */ - Event::listen( function( ModulesBootedEvent $event ) { + Event::listen( function ( ModulesBootedEvent $event ) { $this->loadConfiguration(); }); } diff --git a/app/Providers/CrudServiceProvider.php b/app/Providers/CrudServiceProvider.php index fc43522af..998968c30 100644 --- a/app/Providers/CrudServiceProvider.php +++ b/app/Providers/CrudServiceProvider.php @@ -63,7 +63,7 @@ public function boot() * every crud class on the system should be * added here in order to be available and supported. */ - Hook::addFilter( 'ns-crud-resource', function( $namespace ) { + Hook::addFilter( 'ns-crud-resource', function ( $namespace ) { switch ( $namespace ) { case 'ns.orders': return OrderCrud::class; case 'ns.orders-instalments': return OrderInstalmentCrud::class; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 8c274491b..a2b74d9a1 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -41,7 +41,7 @@ protected function discoverEventsWithin() */ $modulesServices = app()->make( ModulesService::class ); - $paths = collect( $modulesServices->getEnabled() )->map( function( $module ) { + $paths = collect( $modulesServices->getEnabled() )->map( function ( $module ) { return base_path( 'modules' . DIRECTORY_SEPARATOR . $module[ 'namespace' ] . DIRECTORY_SEPARATOR . 'Listeners' ); }) ->values() diff --git a/app/Providers/FormsProvider.php b/app/Providers/FormsProvider.php index 2ad2518ed..5f7d844ba 100644 --- a/app/Providers/FormsProvider.php +++ b/app/Providers/FormsProvider.php @@ -43,7 +43,7 @@ public function register() */ public function boot() { - Hook::addFilter( 'ns.forms', function( $class, $identifier ) { + Hook::addFilter( 'ns.forms', function ( $class, $identifier ) { switch ( $identifier ) { case 'ns.user-profile': return new UserProfileForm; @@ -59,7 +59,7 @@ public function boot() return $class; }, 10, 2 ); - Hook::addFilter( 'ns.fields', function( $class, $identifier ) { + Hook::addFilter( 'ns.fields', function ( $class, $identifier ) { switch ( $class ) { case 'ns.login' : return new AuthLoginFields; diff --git a/app/Providers/LocalizationServiceProvider.php b/app/Providers/LocalizationServiceProvider.php index 0d4cecc7f..3e826b084 100644 --- a/app/Providers/LocalizationServiceProvider.php +++ b/app/Providers/LocalizationServiceProvider.php @@ -17,7 +17,7 @@ class LocalizationServiceProvider extends ServiceProvider */ public function register() { - Event::listen( function( LocaleDefinedEvent $event ) { + Event::listen( function ( LocaleDefinedEvent $event ) { $this->loadModuleLocale(); }); } @@ -44,7 +44,7 @@ protected function loadModuleLocale() Storage::disk( 'ns-modules' )->exists( $module[ 'langFiles' ][ app()->getLocale() ] ) ) { $locales = json_decode( file_get_contents( base_path( 'modules' . DIRECTORY_SEPARATOR . $module[ 'langFiles' ][ app()->getLocale() ] ) ), true ); - $newLocales = collect( $locales )->mapWithKeys( function( $value, $key ) use ( $module ) { + $newLocales = collect( $locales )->mapWithKeys( function ( $value, $key ) use ( $module ) { $key = $module[ 'namespace' ] . '.' . $key; return [ $key => $value ]; diff --git a/app/Providers/ModulesServiceProvider.php b/app/Providers/ModulesServiceProvider.php index 9472203ed..fedb7b167 100644 --- a/app/Providers/ModulesServiceProvider.php +++ b/app/Providers/ModulesServiceProvider.php @@ -24,7 +24,7 @@ public function boot( ModulesService $modules ) * trigger boot method only for enabled modules * service providers that extends ModulesServiceProvider. */ - collect( $modules->getEnabled() )->each( function( $module ) use ( $modules ) { + collect( $modules->getEnabled() )->each( function ( $module ) use ( $modules ) { $modules->triggerServiceProviders( $module, 'boot', ServiceProvider::class ); }); @@ -44,7 +44,7 @@ public function boot( ModulesService $modules ) */ public function register() { - $this->app->singleton( ModulesService::class, function( $app ) { + $this->app->singleton( ModulesService::class, function ( $app ) { $this->modules = new ModulesService; $this->modules->load(); @@ -54,7 +54,7 @@ public function register() * trigger register method only for enabled modules * service providers that extends ModulesServiceProvider. */ - collect( $this->modules->getEnabled() )->each( function( $module ) { + collect( $this->modules->getEnabled() )->each( function ( $module ) { /** * register module commands */ diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index a49afc20c..36137d0b1 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -127,7 +127,7 @@ protected function mapModulesRoutes() */ $domainString = ( $domain[ 'filename' ] ?: 'localhost' ) . ( isset( $domain[ 'extension' ] ) ? '.' . $domain[ 'extension' ] : '' ); - Route::domain( $domainString )->group( function() use ( $module ) { + Route::domain( $domainString )->group( function () use ( $module ) { $this->mapModuleWebRoutes( $module ); }); } else { @@ -146,7 +146,7 @@ protected function mapModulesRoutes() */ $domainString = ( $domain[ 'filename' ] ?: 'localhost' ) . ( isset( $domain[ 'extension' ] ) ? '.' . $domain[ 'extension' ] : '' ); - Route::domain( $domainString )->group( function() use ( $module ) { + Route::domain( $domainString )->group( function () use ( $module ) { $this->mapModuleApiRoutes( $module ); }); } else { diff --git a/app/Providers/SettingsPageProvider.php b/app/Providers/SettingsPageProvider.php index 196fa1dd7..ffa8695b1 100644 --- a/app/Providers/SettingsPageProvider.php +++ b/app/Providers/SettingsPageProvider.php @@ -33,7 +33,7 @@ public function register() */ public function boot() { - Hook::addFilter( 'ns.settings', function( $class, $identifier ) { + Hook::addFilter( 'ns.settings', function ( $class, $identifier ) { switch ( $identifier ) { case 'ns.general': return new GeneralSettings; break; diff --git a/app/Services/CashRegistersService.php b/app/Services/CashRegistersService.php index 4175e9f6d..54f6ff967 100644 --- a/app/Services/CashRegistersService.php +++ b/app/Services/CashRegistersService.php @@ -244,7 +244,7 @@ public function recordCashRegisterHistorySale( Order $order ) * We'll only track on that cash register * payment that was recorded on the current register */ - $payments->each( function( OrderPayment $payment ) use ( $order, $register ) { + $payments->each( function ( OrderPayment $payment ) use ( $order, $register ) { $isRecorded = RegisterHistory::where( 'order_id', $order->id ) ->where( 'payment_id', $payment->id ) ->where( 'register_id', $register->id ) diff --git a/app/Services/CoreService.php b/app/Services/CoreService.php index 84cf466b8..885a14fa9 100644 --- a/app/Services/CoreService.php +++ b/app/Services/CoreService.php @@ -121,7 +121,7 @@ public function allowedTo( $permissions ): bool { $passed = false; - collect( $permissions )->each( function( $permission ) use ( &$passed ) { + collect( $permissions )->each( function ( $permission ) use ( &$passed ) { $userPermissionsNamespaces = collect( Auth::user()->permissions() ) ->toArray(); @@ -158,14 +158,14 @@ public function hasRole( $roleNamespace ) public function purgeMissingMigrations() { $migrations = collect( Migration::get() ) - ->map( function( $migration ) { + ->map( function ( $migration ) { return $migration->migration; }); $rawFiles = collect( Storage::disk( 'ns' ) ->allFiles( 'database/migrations' ) ); - $files = $rawFiles->map( function( $file ) { + $files = $rawFiles->map( function ( $file ) { $details = pathinfo( $file ); return $details[ 'filename' ]; diff --git a/app/Services/CrudService.php b/app/Services/CrudService.php index 850f9cf76..d8c95d707 100644 --- a/app/Services/CrudService.php +++ b/app/Services/CrudService.php @@ -519,7 +519,7 @@ public function getEntries( $config = [] ): array $relations = []; $relatedTables = []; - collect( $this->getRelations() )->each( function( $relation ) use ( &$relations, &$relatedTables ) { + collect( $this->getRelations() )->each( function ( $relation ) use ( &$relations, &$relatedTables ) { if ( isset( $relation[0] ) ) { if ( ! is_array( $relation[0] ) ) { $relations[] = $relation; @@ -530,7 +530,7 @@ public function getEntries( $config = [] ): array */ $relatedTables[] = $this->__extractTable( $relation ); } else { - collect( $relation )->each( function( $_relation ) use ( &$relations, &$relatedTables ) { + collect( $relation )->each( function ( $_relation ) use ( &$relations, &$relatedTables ) { $relations[] = $_relation; /** @@ -575,7 +575,7 @@ public function getEntries( $config = [] ): array $hasAlias[0] = $this->hookTableName( $hasAlias[0] ); // make the table name hookable $aliasName = $hasAlias[1] ?? false; // for aliased relation. The pick use the alias as a reference. $columns = collect( Schema::getColumnListing( count( $hasAlias ) === 2 ? trim( $hasAlias[0] ) : $relation[0] ) ) - ->filter( function( $column ) use ( $pick, $table, $aliasName ) { + ->filter( function ( $column ) use ( $pick, $table, $aliasName ) { $picked = $pick[ $aliasName ? trim( $aliasName ) : $table ] ?? []; if ( ! empty( $picked ) ) { if ( in_array( $column, $picked ) ) { @@ -785,7 +785,7 @@ public function getEntries( $config = [] ): array * searching */ if ( $request->query( 'search' ) ) { - $query->where( function( $query ) use ( $request, $columnsLongName ) { + $query->where( function ( $query ) use ( $request, $columnsLongName ) { foreach ( $columnsLongName as $index => $column ) { if ( $index == 0 ) { $query->where( $column, 'like', "%{$request->query( 'search' )}%" ); @@ -829,7 +829,7 @@ public function getEntries( $config = [] ): array * looping entries to provide inline * options */ - $entries[ 'data' ] = collect( $entries[ 'data' ] )->map( function( $entry ) { + $entries[ 'data' ] = collect( $entries[ 'data' ] )->map( function ( $entry ) { $entry = new CrudEntry( (array) $entry ); /** @@ -1129,7 +1129,7 @@ public function isolateArrayRules( $arrayRules, $parentKey = '' ): array $rules = []; foreach ( $arrayRules as $key => $value ) { - if ( is_array( $value ) && collect( array_keys( $value ) )->filter( function( $key ) { + if ( is_array( $value ) && collect( array_keys( $value ) )->filter( function ( $key ) { return is_string( $key ); })->count() > 0 ) { $rules = array_merge( $rules, $this->isolateArrayRules( $value, $key ) ); diff --git a/app/Services/CurrencyService.php b/app/Services/CurrencyService.php index a3e8961b7..ac75bf63c 100644 --- a/app/Services/CurrencyService.php +++ b/app/Services/CurrencyService.php @@ -229,7 +229,7 @@ public function getRaw( $value = null ) } else { return BigDecimal::of( $value )->dividedBy( 1, $this->decimal_precision, RoundingMode::HALF_UP )->toFloat(); } - + return 0; } diff --git a/app/Services/CustomerService.php b/app/Services/CustomerService.php index c8078f1ab..b9f8f48df 100644 --- a/app/Services/CustomerService.php +++ b/app/Services/CustomerService.php @@ -430,7 +430,7 @@ public function computeReward( Order $order ) if ( $reward instanceof RewardSystem ) { $points = 0; - $reward->rules->each( function( $rule ) use ( $order, &$points ) { + $reward->rules->each( function ( $rule ) use ( $order, &$points ) { if ( $order->total >= $rule->from && $order->total <= $rule->to ) { $points += (float) $rule->reward; } @@ -554,7 +554,7 @@ public function setCoupon( $fields, Coupon $coupon ) $this->setActiveStatus( $customerCoupon ); } else { $customerCoupon - ->each( function( $customerCoupon ) use ( $coupon ) { + ->each( function ( $customerCoupon ) use ( $coupon ) { $customerCoupon->name = $coupon->name; $customerCoupon->limit_usage = $coupon->limit_usage; $customerCoupon->code = $coupon->code; @@ -590,7 +590,7 @@ public function deleteRelatedCustomerCoupon( Coupon $coupon ) { CustomerCoupon::couponID( $coupon->id ) ->get() - ->each( function( $coupon ) { + ->each( function ( $coupon ) { $coupon->delete(); }); } diff --git a/app/Services/DemoCoreService.php b/app/Services/DemoCoreService.php index d9517df2e..f01dac880 100644 --- a/app/Services/DemoCoreService.php +++ b/app/Services/DemoCoreService.php @@ -269,8 +269,8 @@ public function performProcurement() 'products' => Product::withStockEnabled() ->with( 'unitGroup' ) ->get() - ->map( function( $product ) { - return $product->unitGroup->units->map( function( $unit ) use ( $product ) { + ->map( function ( $product ) { + return $product->unitGroup->units->map( function ( $unit ) use ( $product ) { $unitQuantity = $product->unit_quantities->filter( fn( $q ) => (int) $q->unit_id === (int) $unit->id )->first(); return (object) [ @@ -279,7 +279,7 @@ public function performProcurement() 'product' => $product, ]; }); - })->flatten()->map( function( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker ) { + })->flatten()->map( function ( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker ) { return [ 'product_id' => $data->product->id, 'gross_purchase_price' => 15, @@ -343,7 +343,7 @@ public function createSales() $shippingFees = $faker->randomElement([10, 15, 20, 25, 30, 35, 40]); $discountRate = $faker->numberBetween(0, 5); - $products = $products->map( function( $product ) use ( $faker ) { + $products = $products->map( function ( $product ) use ( $faker ) { $unitElement = $faker->randomElement( $product->unit_quantities ); return array_merge([ @@ -361,7 +361,7 @@ public function createSales() $customerFirstPurchases = $customer->purchases_amount; $customerFirstOwed = $customer->owed_amount; - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) use ($currency) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) use ($currency) { return $currency ->define( $product[ 'unit_price' ] ) ->multiplyBy( $product[ 'quantity' ] ) diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php index d6e5a7669..032462776 100644 --- a/app/Services/DemoService.php +++ b/app/Services/DemoService.php @@ -152,7 +152,7 @@ public function createProducts() ], 'units' => [ 'selling_group' => $unitGroup - ->units->map( function( $unit ) use ( $product ) { + ->units->map( function ( $unit ) use ( $product ) { return [ 'sale_price_edit' => $product->price * $unit->value, 'wholesale_price_edit' => ns()->currency->getPercentageValue( $product->price, 10, 'substract' ) * $unit->value, @@ -168,7 +168,7 @@ public function createProducts() * if groups is provided */ if ( isset( $product->groups ) ) { - $subProducts = collect( $product->groups )->map( function( $productName ) { + $subProducts = collect( $product->groups )->map( function ( $productName ) { $subProduct = Product::where( 'name', $productName ) ->with( 'unit_quantities' ) ->first(); diff --git a/app/Services/DoctorService.php b/app/Services/DoctorService.php index bbc177796..8b2dc95b7 100644 --- a/app/Services/DoctorService.php +++ b/app/Services/DoctorService.php @@ -27,7 +27,7 @@ public function __construct( protected Command $command) public function createUserAttribute(): array { - User::get()->each( function( User $user ) { + User::get()->each( function ( User $user ) { if ( ! $user->attribute instanceof UserAttribute ) { $attribute = new UserAttribute; $attribute->user_id = $user->id; @@ -82,7 +82,7 @@ public function restoreRoles() public function fixDuplicateOptions() { $options = Option::get(); - $options->each( function( $option ) { + $options->each( function ( $option ) { try { $option->refresh(); if ( $option instanceof Option ) { @@ -156,7 +156,7 @@ public function fixCashFlowOrders( DoctorCommand $command ) $command->info( __( 'Restoring cash flow from paid orders...' ) ); - $command->withProgressBar( $orders, function( $order ) use ( $expenseService ) { + $command->withProgressBar( $orders, function ( $order ) use ( $expenseService ) { $expenseService->handleCreatedOrder( $order ); }); @@ -172,8 +172,8 @@ public function fixCashFlowOrders( DoctorCommand $command ) Order::PAYMENT_PARTIALLY_REFUNDED, ])->get(); - $command->withProgressBar( $orders, function( $order ) use ( $expenseService ) { - $order->refundedProducts()->with( 'orderProduct' )->get()->each( function( $orderRefundedProduct ) use ( $order, $expenseService ) { + $command->withProgressBar( $orders, function ( $order ) use ( $expenseService ) { + $order->refundedProducts()->with( 'orderProduct' )->get()->each( function ( $orderRefundedProduct ) use ( $order, $expenseService ) { $expenseService->createExpenseFromRefund( order: $order, orderProductRefund: $orderRefundedProduct, @@ -188,7 +188,7 @@ public function fixCashFlowOrders( DoctorCommand $command ) public function fixCustomers() { $this->command - ->withProgressBar( Customer::with([ 'billing', 'shipping' ])->get(), function( $customer ) { + ->withProgressBar( Customer::with([ 'billing', 'shipping' ])->get(), function ( $customer ) { if ( ! $customer->billing instanceof CustomerBillingAddress ) { $billing = new CustomerBillingAddress; $billing->customer_id = $customer->id; diff --git a/app/Services/EloquenizeArrayService.php b/app/Services/EloquenizeArrayService.php index 4887198a0..7058f8910 100644 --- a/app/Services/EloquenizeArrayService.php +++ b/app/Services/EloquenizeArrayService.php @@ -8,7 +8,7 @@ class EloquenizeArrayService { public function parse( Builder $query, $data ) { - $query->where( function( $query ) use ( $data ) { + $query->where( function ( $query ) use ( $data ) { foreach ( $data as $fieldName => $arguments ) { match ( $arguments[ 'comparison' ] ) { '<>' => $query->where( $fieldName, '<>', $arguments[ 'value' ] ), diff --git a/app/Services/ExpenseService.php b/app/Services/ExpenseService.php index e166875db..3c968b30b 100644 --- a/app/Services/ExpenseService.php +++ b/app/Services/ExpenseService.php @@ -178,7 +178,7 @@ public function deleteAccountType( $id, $force = true ) * if there is not expense, it * won't be looped */ - $accountType->expenses->map( function( $expense ) { + $accountType->expenses->map( function ( $expense ) { $expense->delete(); }); @@ -210,7 +210,7 @@ public function deleteCategory( $id, $force = false ) * if there is not expense, it * won't be looped */ - $accountType->expenses->map( function( $expense ) { + $accountType->expenses->map( function ( $expense ) { $expense->delete(); }); @@ -346,7 +346,7 @@ public function getCategoryExpense( $id ) public function recordCashFlowHistory( Expense $expense ) { if ( ! empty( $expense->group_id ) ) { - Role::find( $expense->group_id )->users->each( function( $user ) use ( $expense ) { + Role::find( $expense->group_id )->users->each( function ( $user ) use ( $expense ) { if ( $expense->category instanceof ExpenseCategory ) { $history = new CashFlow; $history->value = $expense->value; @@ -416,7 +416,7 @@ public function handleRecurringExpenses() $processStatus = Expense::recurring() ->active() ->get() - ->map( function( $expense ) { + ->map( function ( $expense ) { switch ( $expense->occurrence ) { case 'month_starts': $expenseScheduledDate = Carbon::parse( $this->dateService->copy()->startOfMonth() ); @@ -734,7 +734,7 @@ public function processRefundedOrders( $rangeStarts, $rangeEnds ) $expenseCategory = $this->getAccountTypeByCode( CashFlow::ACCOUNT_REFUNDS ); - $orders->each( function( $order ) use ( $expenseCategory ) { + $orders->each( function ( $order ) use ( $expenseCategory ) { $expense = new Expense; $expense->value = $order->total; $expense->active = true; @@ -770,7 +770,7 @@ public function processPaidOrders( $rangeStart, $rangeEnds ) Customer::where( 'id', '>', 0 )->update([ 'purchases_amount' => 0 ]); - $orders->each( function( $order ) use ( $expenseCategory ) { + $orders->each( function ( $order ) use ( $expenseCategory ) { $expense = new Expense; $expense->value = $order->total; $expense->active = true; @@ -805,7 +805,7 @@ public function processCustomerAccountHistories( $rangeStarts, $rangeEnds ) ->where( 'created_at', '<=', $rangeEnds ) ->get(); - $histories->each( function( $history ) { + $histories->each( function ( $history ) { $this->handleCustomerCredit( $history ); }); } @@ -819,7 +819,7 @@ public function processProcurements( $rangeStarts, $rangeEnds ) { Procurement::where( 'created_at', '>=', $rangeStarts ) ->where( 'created_at', '<=', $rangeEnds ) - ->get()->each( function( $procurement ) { + ->get()->each( function ( $procurement ) { $this->handleProcurementExpense( $procurement ); }); } @@ -835,7 +835,7 @@ public function processExpenses( $rangeStarts, $rangeEnds ) ->where( 'created_at', '<=', $rangeEnds ) ->notRecurring() ->get() - ->each( function( $expense ) { + ->each( function ( $expense ) { $this->triggerExpense( $expense ); }); } diff --git a/app/Services/Helpers/App.php b/app/Services/Helpers/App.php index 19ef6eb52..081a813a5 100644 --- a/app/Services/Helpers/App.php +++ b/app/Services/Helpers/App.php @@ -29,7 +29,7 @@ public static function installed( $force = false ) * * @see App\Http\Middleware\ClearRequestCacheMiddleware */ - return Cache::remember( 'ns-core-installed', 3600, function() { + return Cache::remember( 'ns-core-installed', 3600, function () { return self::checkDatabaseExistence(); }); } diff --git a/app/Services/Helpers/ArrayHelper.php b/app/Services/Helpers/ArrayHelper.php index 7279b02e2..c3d527366 100644 --- a/app/Services/Helpers/ArrayHelper.php +++ b/app/Services/Helpers/ArrayHelper.php @@ -142,7 +142,7 @@ public static function kvToJsOptions( $array ) */ public static function flatArrayWithKeys( $data ) { - return collect( $data )->mapWithKeys( function( $data, $index ) { + return collect( $data )->mapWithKeys( function ( $data, $index ) { if ( ! is_array( $data ) || is_numeric( $index ) ) { return [ $index => $data ]; } elseif ( is_array( $data ) ) { @@ -154,7 +154,7 @@ public static function flatArrayWithKeys( $data ) } return []; - })->filter( function( $field ) { + })->filter( function ( $field ) { return $field !== false; }); } diff --git a/app/Services/ModulesService.php b/app/Services/ModulesService.php index 57d016724..ec14b71d4 100644 --- a/app/Services/ModulesService.php +++ b/app/Services/ModulesService.php @@ -88,9 +88,9 @@ public function load( $dir = null ) * intersect modules/ and remove it * to make sure $this->__init can load successfully. */ - collect( $directories )->map( function( $module ) { + collect( $directories )->map( function ( $module ) { return str_replace( '/', '\\', $module ); - })->each( function( $module ) { + })->each( function ( $module ) { $this->__init( $module ); }); } else { @@ -114,7 +114,7 @@ public function __init( string $dir ) /** * Just retrieve the files name */ - $files = array_map( function( $file ) { + $files = array_map( function ( $file ) { $info = pathinfo( $file ); return $info[ 'basename' ]; @@ -149,7 +149,7 @@ public function __init( string $dir ) ]; } - $config[ 'requires' ] = collect( $xmlElement->children()->requires->xpath( '//dependency' ) )->mapWithKeys( function( $module ) { + $config[ 'requires' ] = collect( $xmlElement->children()->requires->xpath( '//dependency' ) )->mapWithKeys( function ( $module ) { $module = (array) $module; return [ @@ -209,7 +209,7 @@ public function __init( string $dir ) $config[ 'actions' ] = $this->getAllValidFiles( Storage::disk( 'ns-modules' )->allFiles( $config[ 'namespace' ] . DIRECTORY_SEPARATOR . 'Actions' ) ); $config[ 'filters' ] = $this->getAllValidFiles( Storage::disk( 'ns-modules' )->allFiles( $config[ 'namespace' ] . DIRECTORY_SEPARATOR . 'Filters' ) ); $config[ 'commands' ] = collect( Storage::disk( 'ns-modules' )->allFiles( $config[ 'namespace' ] . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'Commands' ) ) - ->mapWithKeys( function( $file ) { + ->mapWithKeys( function ( $file ) { $className = str_replace( ['/', '.php'], ['\\', ''], @@ -253,7 +253,7 @@ public function __init( string $dir ) ->allFiles( $config[ 'namespace' ] . DIRECTORY_SEPARATOR . 'Lang' ); $rawFiles = $this->getAllValidFiles( $rawFiles, [ 'json' ] ); - $config[ 'langFiles' ] = collect( $rawFiles )->mapWithKeys( function( $file ) { + $config[ 'langFiles' ] = collect( $rawFiles )->mapWithKeys( function ( $file ) { $pathInfo = pathinfo( $file ); return [ $pathInfo[ 'filename' ] => $file ]; @@ -317,7 +317,7 @@ public function triggerServiceProviders( $config, $method, $parentClass = false public function dependenciesCheck( $module = null ) { if ( $module === null ) { - collect( $this->getEnabled() )->each( function( $module ) { + collect( $this->getEnabled() )->each( function ( $module ) { $this->dependenciesCheck( $module ); }); } else { @@ -326,7 +326,7 @@ public function dependenciesCheck( $module = null ) * are meet for the provided modules */ if ( isset( $module[ 'requires' ] ) ) { - collect( $module[ 'requires' ] )->each( function( $dependency, $namespace ) use ( $module ) { + collect( $module[ 'requires' ] )->each( function ( $dependency, $namespace ) use ( $module ) { if ( $this->get( $namespace ) === null ) { /** * The dependency is missing @@ -494,7 +494,7 @@ public function getIfEnabled( $namespace ) */ public function getEnabled() { - return array_filter( $this->modules, function( $module ) { + return array_filter( $this->modules, function ( $module ) { if ( $module[ 'enabled' ] === true ) { return $module; } @@ -508,7 +508,7 @@ public function getEnabled() */ public function getDisabled() { - return array_filter( $this->modules, function( $module ) { + return array_filter( $this->modules, function ( $module ) { if ( $module[ 'enabled' ] === false ) { return $module; } @@ -583,7 +583,7 @@ public function extract( $namespace ) * if a file is within an exclude * match the looped file, it's skipped */ - $files = array_values( collect( $files )->filter( function( $file ) use ( $manifest, $namespace ) { + $files = array_values( collect( $files )->filter( function ( $file ) use ( $manifest, $namespace ) { if ( is_array( @$manifest[ 'exclude' ] ) ) { foreach ( $manifest[ 'exclude' ] as $check ) { if ( fnmatch( ucwords( $namespace ) . '/' . $check, $file ) ) { @@ -679,7 +679,7 @@ public function upload( $file ) /** * Just retrieve the files name */ - $files = array_map( function( $file ) { + $files = array_map( function ( $file ) { $info = pathinfo( $file ); return $info[ 'basename' ]; @@ -1037,7 +1037,7 @@ public function revertMigrations( $module, $only = [] ) * migration, we'll use the $only argument */ if ( ! empty( $only ) ) { - $migrationFiles = collect( $migrationFiles )->filter( function( $file ) use ( $only ) { + $migrationFiles = collect( $migrationFiles )->filter( function ( $file ) use ( $only ) { return in_array( $file, $only ); })->toArray(); } @@ -1324,7 +1324,7 @@ private function __getModuleMigration( $module, $cache = true ) * that means we're running it for the first time * we'll set the migration to 0.0 then. */ - $migratedFiles = $cache === true ? Cache::remember( self::CACHE_MIGRATION_LABEL . $module[ 'namespace' ], 3600 * 24, function() use ( $module ) { + $migratedFiles = $cache === true ? Cache::remember( self::CACHE_MIGRATION_LABEL . $module[ 'namespace' ], 3600 * 24, function () use ( $module ) { return $this->getModuleAlreadyMigratedFiles( $module ); }) : $this->getModuleAlreadyMigratedFiles( $module ); @@ -1392,7 +1392,7 @@ private function getAllValidFiles( $files, $extensions = [ 'php' ] ) * We only want to restrict file * that has the ".php" extension. */ - return collect( $files )->filter( function( $file ) use ( $extensions ) { + return collect( $files )->filter( function ( $file ) use ( $extensions ) { $details = pathinfo( $file ); return isset( $details[ 'extension' ] ) && in_array( $details[ 'extension' ], $extensions ); @@ -1490,7 +1490,7 @@ public function dropAllMigrations( $namespace ) */ public function serviceProvider( $module, $instance, $method, $params = null ) { - collect( $module[ 'providers' ] )->each( function( $provider ) use ( $instance, $params, $method ) { + collect( $module[ 'providers' ] )->each( function ( $provider ) use ( $instance, $params, $method ) { if ( $provider instanceof $instance ) { $provider->$method( $params ); } diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index 457151f1d..a33359785 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -59,18 +59,18 @@ public function create( $config ) public function dispatchForGroup( $role ) { if ( is_array( $role ) ) { - collect( $role )->each( function( $role ) { + collect( $role )->each( function ( $role ) { $this->dispatchForGroup( $role ); }); } elseif ( $role instanceof Collection ) { - $role->each( function( $role ) { + $role->each( function ( $role ) { $this->dispatchForGroup( $role ); }); } elseif ( is_string( $role ) ) { $roleInstance = Role::namespace( $role ); $this->dispatchForGroup( $roleInstance ); } else { - $role->users->map( function( $user ) { + $role->users->map( function ( $user ) { $this->__makeNotificationFor( $user ); }); } @@ -122,7 +122,7 @@ private function __makeNotificationFor( $user ) public function dispatchForUsers( Collection $users ) { - $users->map( function( $user ) { + $users->map( function ( $user ) { $this->__makeNotificationFor( $user ); }); } @@ -142,7 +142,7 @@ public function deleteHavingIdentifier( $identifier ) { Notification::identifiedBy( $identifier ) ->get() - ->each( function( $notification ) { + ->each( function ( $notification ) { NotificationDeletedEvent::dispatch( $notification ); $this->proceedDeleteNotification( $notification ); }); @@ -161,7 +161,7 @@ public function deleteNotificationsFor( User $user ) { Notification::for( $user->id ) ->get() - ->each( function( $notification ) { + ->each( function ( $notification ) { NotificationDeletedEvent::dispatch( $notification ); $this->proceedDeleteNotification( $notification ); diff --git a/app/Services/Options.php b/app/Services/Options.php index fcca8fdf3..040f56d9f 100644 --- a/app/Services/Options.php +++ b/app/Services/Options.php @@ -81,7 +81,7 @@ public function build() if ( Helper::installed() && empty( $this->rawOptions ) ) { $this->rawOptions = $this->option() ->get() - ->mapWithKeys( function( $option ) { + ->mapWithKeys( function ( $option ) { return [ $option->key => $option, ]; @@ -175,11 +175,11 @@ public function get( $key = null, $default = null ) return $this->rawOptions; } - $filtredOptions = collect( $this->rawOptions )->filter( function( $option ) use ( $key ) { + $filtredOptions = collect( $this->rawOptions )->filter( function ( $option ) use ( $key ) { return is_array( $key ) ? in_array( $option->key, $key ) : $option->key === $key; }); - $options = $filtredOptions->map( function( $option ) { + $options = $filtredOptions->map( function ( $option ) { /** * We should'nt run this everytime we * try to pull an option from the database or from the array @@ -219,7 +219,7 @@ public function get( $key = null, $default = null ) **/ public function delete( $key ): void { - $this->rawOptions = collect( $this->rawOptions )->filter( function( Option $option ) use ( $key ) { + $this->rawOptions = collect( $this->rawOptions )->filter( function ( Option $option ) use ( $key ) { if ( $option->key === $key ) { $option->delete(); diff --git a/app/Services/OrdersService.php b/app/Services/OrdersService.php index 56977e585..4498c5182 100644 --- a/app/Services/OrdersService.php +++ b/app/Services/OrdersService.php @@ -312,7 +312,7 @@ public function __checkProvidedInstalments( $fields ) */ public function __checkAttachedCoupons( $coupons ) { - collect( $coupons )->each( function( $coupon ) { + collect( $coupons )->each( function ( $coupon ) { $customerCoupon = CustomerCoupon::find( $coupon[ 'customer_coupon_id' ] ); if ( ! $customerCoupon instanceof CustomerCoupon ) { @@ -493,7 +493,7 @@ public function __deleteUntrackedProducts( $order, $products ) * adjustment accordingly. In that case we'll use adjustment-return & sale. */ if ( $order->payment_status !== Order::PAYMENT_HOLD ) { - $order->products->map( function( OrderProduct $product ) use ( $products ) { + $order->products->map( function ( OrderProduct $product ) use ( $products ) { $productHistory = ProductHistory::where( 'operation_type', ProductHistory::ACTION_SOLD ) ->where( 'order_product_id', $product->id ) ->first(); @@ -536,7 +536,7 @@ public function __deleteUntrackedProducts( $order, $products ) return false; }) ->filter( fn( $adjustment ) => $adjustment !== false ) - ->each( function( $adjustment ) use ( $order ) { + ->each( function ( $adjustment ) use ( $order ) { if ( $adjustment[ 'operation' ] === 'remove' ) { $adjustment[ 'orderProduct' ]->quantity -= $adjustment[ 'quantity' ]; @@ -580,7 +580,7 @@ public function __deleteUntrackedProducts( $order, $products ) * proceesed another time should be removed. If the order has * already affected the stock, we should make some adjustments. */ - $order->products->each( function( $orderProduct ) use ( $ids, $order ) { + $order->products->each( function ( $orderProduct ) use ( $ids, $order ) { /** * if a product has the unit id changed * the product he considered as new and the old is returned @@ -859,7 +859,7 @@ private function __checkOrderPayments( $fields, Order $order = null, Customer $c ->filter( fn( $payment ) => $payment !== false ) ->toArray(); - $order->payments->each( function( $payment ) use ( $paymentIds ) { + $order->payments->each( function ( $payment ) use ( $paymentIds ) { if ( ! in_array( $payment->id, $paymentIds ) ) { throw new NotAllowedException( __( 'Unable to proceed as one of the previous submitted payment is missing from the order.' ) ); } @@ -1064,8 +1064,8 @@ private function __saveOrderProducts($order, $products) $orderProduct->product_category_id = $product[ 'product' ]->category_id ?? 0; $orderProduct->name = $product[ 'product' ]->name ?? $product[ 'name' ] ?? __( 'Unnamed Product' ); $orderProduct->quantity = $product[ 'quantity' ]; - $orderProduct->price_with_tax = $product[ 'price_with_tax' ]; - $orderProduct->price_without_tax = $product[ 'price_without_tax' ]; + $orderProduct->price_with_tax = $product[ 'price_with_tax' ] ?? 0; + $orderProduct->price_without_tax = $product[ 'price_without_tax' ] ?? 0; /** * We might need to have another consideration @@ -1148,7 +1148,7 @@ private function __saveOrderProducts($order, $products) private function __buildOrderProducts( $products ) { - return collect( $products )->map( function( $orderProduct ) { + return collect( $products )->map( function ( $orderProduct ) { /** * by default, we'll assume a quick * product is being created. @@ -1157,7 +1157,7 @@ private function __buildOrderProducts( $products ) $productUnitQuantity = null; if ( ! empty( $orderProduct[ 'sku' ] ?? null ) || ! empty( $orderProduct[ 'product_id' ] ?? null ) ) { - $product = Cache::remember( 'store-' . ( $orderProduct['product_id'] ?? $orderProduct['sku'] ), 60, function() use ($orderProduct) { + $product = Cache::remember( 'store-' . ( $orderProduct['product_id'] ?? $orderProduct['sku'] ), 60, function () use ($orderProduct) { if ( ! empty( $orderProduct['product_id'] ?? null ) ) { return $this->productService->get($orderProduct['product_id']); } elseif ( ! empty( $orderProduct['sku'] ?? null ) ) { @@ -1203,7 +1203,7 @@ private function __checkProductStock( SupportCollection $items, Order $order = n $orderProduct[ 'product' ]->load( 'sub_items.product' ); $orderProduct[ 'product' ] ->sub_items - ->each( function( ProductSubItem $subitem ) use ( $session_identifier, $orderProduct ) { + ->each( function ( ProductSubItem $subitem ) use ( $session_identifier, $orderProduct ) { /** * Stock management should be enabled * for the sub item. @@ -1577,7 +1577,7 @@ public function computeOrderDiscount( $order, $fields = [] ) */ public function computeTaxFromOrderTaxes( Order $order, $value, $type = 'inclusive' ) { - return $order->taxes->map( function( $tax ) use ( $value, $type ) { + return $order->taxes->map( function ( $tax ) use ( $value, $type ) { $result = $this->taxService->getVatValue( $type, $tax->rate, $value ); @@ -1597,7 +1597,7 @@ public function computeTaxFromOrderTaxes( Order $order, $value, $type = 'inclusi */ public function getTaxComputedFromOrderTaxes( Order $order, $value, $type ) { - $rates = $order->taxes->map( function( $tax ) { + $rates = $order->taxes->map( function ( $tax ) { return $tax->rate; })->sum(); @@ -1635,7 +1635,7 @@ public function computeOrderTaxes( Order $order ) ->validProducts() ->sum( 'total_price' ); - $taxValue = $order->taxes->map( function( $tax ) use ( $order, $subTotal ) { + $taxValue = $order->taxes->map( function ( $tax ) use ( $order, $subTotal ) { $tax->tax_value = $this->taxService->getVatValue( $order->tax_type, $tax->rate, $subTotal ); $tax->save(); @@ -1724,7 +1724,7 @@ public function refundOrder( Order $order, $fields ) $order->shipping = 0; } - $taxValue = collect( $results )->map( function( $result ) { + $taxValue = collect( $results )->map( function ( $result ) { $refundProduct = $result[ 'data' ][ 'productRefund' ]; return $refundProduct->tax_value; @@ -2052,7 +2052,7 @@ public function refreshOrder(Order $order) return floatval($product->total_price); })->sum(); - $productsQuantity = $products->map( function( $product) { + $productsQuantity = $products->map( function ( $product) { return floatval( $product->quantity ); })->sum(); @@ -2159,7 +2159,7 @@ public function deleteOrder(Order $order) $order ->products() ->get() - ->each( function( OrderProduct $orderProduct) { + ->each( function ( OrderProduct $orderProduct) { $orderProduct->load( 'product' ); $product = $orderProduct->product; /** @@ -2254,13 +2254,13 @@ public function getOrderPayments($orderID) */ public function getPaymentTypes() { - $payments = PaymentType::active()->get()->map( function( $payment, $index ) { + $payments = PaymentType::active()->get()->map( function ( $payment, $index ) { $payment->selected = $index === 0; return $payment; }); - return collect( $payments )->mapWithKeys( function( $payment ) { + return collect( $payments )->mapWithKeys( function ( $payment ) { return [ $payment[ 'identifier' ] => $payment[ 'label' ] ]; })->toArray(); } @@ -2343,7 +2343,7 @@ public function getProcessStatus( $type ) */ public function getTypeLabels() { - $types = Hook::filter( 'ns-order-types-labels', collect( $this->getTypeOptions() )->mapWithKeys( function( $option ) { + $types = Hook::filter( 'ns-order-types-labels', collect( $this->getTypeOptions() )->mapWithKeys( function ( $option ) { return [ $option[ 'identifier' ] => $option[ 'label' ], ]; @@ -2482,7 +2482,7 @@ public function notifyExpiredLaidAway() * The status changes according to the fact * if some orders has received a payment. */ - $orders->each( function( $order ) { + $orders->each( function ( $order ) { if ( $order->paid > 0 ) { $order->payment_status = Order::PAYMENT_PARTIALLY_DUE; } else { @@ -2541,7 +2541,7 @@ public function void( Order $order, $reason ) { $order->products() ->get() - ->each( function( OrderProduct $orderProduct ) { + ->each( function ( OrderProduct $orderProduct ) { $orderProduct->load( 'product' ); if ( $orderProduct->product instanceof Product ) { @@ -2598,7 +2598,7 @@ public function getSoldStock( $startDate, $endDate ) $rangeStarts = Carbon::parse( $startDate )->toDateTimeString(); $rangeEnds = Carbon::parse( $endDate )->toDateTimeString(); - $products = OrderProduct::whereHas( 'order', function( Builder $query ) { + $products = OrderProduct::whereHas( 'order', function ( Builder $query ) { $query->where( 'payment_status', Order::PAYMENT_PAID ); }) ->where( 'created_at', '>=', $rangeStarts ) @@ -2610,7 +2610,7 @@ public function getSoldStock( $startDate, $endDate ) public function trackOrderCoupons( Order $order ) { - $order->coupons->each( function( OrderCoupon $orderCoupon ) { + $order->coupons->each( function ( OrderCoupon $orderCoupon ) { $customerCoupon = CustomerCoupon::find( $orderCoupon->customer_coupon_id ); if ( ! $customerCoupon instanceof CustomerCoupon ) { @@ -2660,7 +2660,7 @@ public function resolveInstalments( Order $order ) ->getRaw(); $orderInstalments - ->each( function( $instalment ) use ( &$payableDifference ) { + ->each( function ( $instalment ) use ( &$payableDifference ) { if ( $payableDifference - $instalment->amount >= 0 ) { $instalment->paid = true; $instalment->save(); @@ -2865,7 +2865,7 @@ public function getPaymentTypesReport( $startRange, $endRange ) $total = $payments->map( fn( $payment ) => $payment->value )->sum(); return [ - 'summary' => $paymentTypes->map( function( $paymentType ) use ( $payments ) { + 'summary' => $paymentTypes->map( function ( $paymentType ) use ( $payments ) { $total = $payments ->filter( fn( $payment ) => $payment->identifier === $paymentType->identifier ) ->map( fn( $payment ) => $payment->value ) diff --git a/app/Services/ProcurementService.php b/app/Services/ProcurementService.php index b47f1935c..7a632a575 100644 --- a/app/Services/ProcurementService.php +++ b/app/Services/ProcurementService.php @@ -119,7 +119,7 @@ public function create( $data ) * We don't want the event ProcurementBeforeCreateEvent * and ProcurementAfterCreateEvent to trigger while saving */ - Procurement::withoutEvents( function() use ( $procurement, $data ) { + Procurement::withoutEvents( function () use ( $procurement, $data ) { $procurement->name = $data[ 'name' ]; foreach ( $data[ 'general' ] as $field => $value ) { @@ -197,7 +197,7 @@ public function edit( $id, $data ) * We won't dispatch the even while savin the procurement * however we'll do that once the product has been stored. */ - Procurement::withoutEvents( function() use ( $data, $procurement ) { + Procurement::withoutEvents( function () use ( $data, $procurement ) { if ( $procurement->delivery_status === 'stocked' ) { throw new Exception( __( 'Unable to edit a procurement that has already been stocked. Please consider performing and stock adjustment.' ) ); } @@ -255,7 +255,7 @@ public function delete( $id ) event( new ProcurementBeforeDeleteEvent( $procurement ) ); - $totalDeletions = $procurement->products->map( function( ProcurementProduct $product ) use ( $procurement ) { + $totalDeletions = $procurement->products->map( function ( ProcurementProduct $product ) use ( $procurement ) { return $this->deleteProduct( $product, $procurement ); })->count(); @@ -276,7 +276,7 @@ public function delete( $id ) public function attemptProductsStockRemoval( Procurement $procurement ) { if ( $procurement->delivery_status === 'stocked' ) { - $procurement->products->each( function( ProcurementProduct $procurementProduct ) { + $procurement->products->each( function ( ProcurementProduct $procurementProduct ) { $unitQuantity = ProductUnitQuantity::withProduct( $procurementProduct->product_id ) ->withUnit( $procurementProduct->unit_id ) ->first(); @@ -298,7 +298,7 @@ public function attemptProductsStockRemoval( Procurement $procurement ) */ public function deleteProcurementProducts( Procurement $procurement ) { - $procurement->products->each( function( ProcurementProduct $product ) use ( $procurement ) { + $procurement->products->each( function ( ProcurementProduct $product ) use ( $procurement ) { $this->deleteProduct( $product, $procurement ); }); } @@ -309,7 +309,7 @@ public function deleteProcurementProducts( Procurement $procurement ) public function computeValue( $id ) { $procurement = Procurement::findOrFail( $id ); - $value = $procurement->products->map( function( $product ) { + $value = $procurement->products->map( function ( $product ) { return $product->price * $product->quantity; }); } @@ -379,7 +379,7 @@ public function saveProducts( Procurement $procurement, Collection $products ) * We'll just make sure to have a reference * of all the product that has been procured. */ - $procuredProducts = $products->map( function( $procuredProduct ) use ( $procurement ) { + $procuredProducts = $products->map( function ( $procuredProduct ) use ( $procurement ) { $product = Product::find( $procuredProduct[ 'product_id' ] ); /** @@ -553,7 +553,7 @@ public function refresh( Procurement $procurement ) */ $productService = app()->make( ProductService::class ); - Procurement::withoutEvents( function() use ( $procurement, $productService ) { + Procurement::withoutEvents( function () use ( $procurement, $productService ) { /** * Let's loop all procured produt * and get unit quantity if that exists @@ -562,7 +562,7 @@ public function refresh( Procurement $procurement ) $purchases = $procurement ->products() ->get() - ->map( function( $procurementProduct ) use ( $productService ) { + ->map( function ( $procurementProduct ) use ( $productService ) { $unitPrice = 0; $unit = $productService->getUnitQuantity( $procurementProduct->product_id, $procurementProduct->unit_id ); @@ -605,7 +605,7 @@ public function resetProcurement( $id ) { $procurement = Procurement::find( $id ); - $procurement->products->each( function( $product ) { + $procurement->products->each( function ( $product ) { $product->delete(); }); @@ -630,7 +630,7 @@ public function resetProcurement( $id ) */ public function deleteProducts( Procurement $procurement ) { - $procurement->products->each( function( $product ) { + $procurement->products->each( function ( $product ) { $product->delete(); }); @@ -652,7 +652,7 @@ public function hasProduct( int $procurement_id, int $product_id ) { $procurement = $this->get( $procurement_id ); - return $procurement->products->filter( function( $product ) use ( $product_id ) { + return $procurement->products->filter( function ( $product ) use ( $product_id ) { return (int) $product->id === (int) $product_id; })->count() > 0; } @@ -786,14 +786,14 @@ public function bulkUpdateProducts( $procurement_id, $products ) ->pluck( 'id' ); $result = collect( $products ) - ->map( function( $product ) use ( $productsId ) { + ->map( function ( $product ) use ( $productsId ) { if ( ! in_array( $product[ 'id' ], $productsId ) ) { throw new Exception( sprintf( __( 'The product with the following ID "%s" is not initially included on the procurement' ), $product[ 'id' ] ) ); } return $product; }) - ->map( function( $product ) { + ->map( function ( $product ) { return $this->updateProcurementProduct( $product[ 'id' ], $product ); }); @@ -818,7 +818,7 @@ public function getProducts( $procurement_id ): EloquentCollection public function setDeliveryStatus( Procurement $procurement, string $status ) { - Procurement::withoutEvents( function() use ( $procurement, $status ) { + Procurement::withoutEvents( function () use ( $procurement, $status ) { $procurement->delivery_status = $status; $procurement->save(); }); @@ -836,7 +836,7 @@ public function handleProcurement( Procurement $procurement ) event( new ProcurementBeforeHandledEvent( $procurement ) ); if ( $procurement->delivery_status === Procurement::DELIVERED ) { - $procurement->products->map( function( ProcurementProduct $product ) { + $procurement->products->map( function ( ProcurementProduct $product ) { /** * We'll keep an history of what has just happened. * in order to monitor how the stock evolve. @@ -899,7 +899,7 @@ public function stockAwaitingProcurements() ->autoApproval() ->get(); - $procurements->each( function( Procurement $procurement ) { + $procurements->each( function ( Procurement $procurement ) { $this->setDeliveryStatus( $procurement, Procurement::DELIVERED ); $this->handleProcurement( $procurement ); }); @@ -952,7 +952,7 @@ public function searchProduct( $argument, $limit = 10 ) Product::TYPE_DEMATERIALIZED, Product::TYPE_MATERIALIZED, ]) - ->where( function( $query ) use ( $argument ) { + ->where( function ( $query ) use ( $argument ) { $query->orWhere( 'name', 'LIKE', "%{$argument}%" ) ->orWhere( 'sku', 'LIKE', "%{$argument}%" ) ->orWhere( 'barcode', 'LIKE', "%{$argument}%" ); @@ -960,12 +960,12 @@ public function searchProduct( $argument, $limit = 10 ) ->with( 'unit_quantities.unit' ) ->limit( $limit ) ->get() - ->map( function( $product ) { + ->map( function ( $product ) { $units = json_decode( $product->purchase_unit_ids ); if ( $units ) { $product->purchase_units = collect(); - collect( $units )->each( function( $unitID ) use ( &$product ) { + collect( $units )->each( function ( $unitID ) use ( &$product ) { $product->purchase_units->push( Unit::find( $unitID ) ); }); } @@ -974,7 +974,7 @@ public function searchProduct( $argument, $limit = 10 ) * We'll pull the last purchase * price for the item retreived */ - $product->unit_quantities->each( function( $unitQuantity ) { + $product->unit_quantities->each( function ( $unitQuantity ) { $lastPurchase = ProcurementProduct::where( 'product_id', $unitQuantity->product_id ) ->where( 'unit_id', $unitQuantity->unit_id ) ->orderBy( 'updated_at', 'desc' ) diff --git a/app/Services/ProductCategoryService.php b/app/Services/ProductCategoryService.php index eab9f6c0a..41e7f7535 100644 --- a/app/Services/ProductCategoryService.php +++ b/app/Services/ProductCategoryService.php @@ -85,7 +85,7 @@ public function getCategoryChildrens( $category_id ) if ( $categories->count() > 0 ) { return $categories - ->map( function( $category ) { + ->map( function ( $category ) { return $this->getCategoryChildrens( $category->id ); }) ->flatten() diff --git a/app/Services/ProductService.php b/app/Services/ProductService.php index 1abaaa00b..0b7d1e955 100644 --- a/app/Services/ProductService.php +++ b/app/Services/ProductService.php @@ -192,7 +192,7 @@ public function createVariableProduct( $data ) * fields are valid. We should do that before saving anything to * the database */ - collect( $data[ 'variations' ] )->each( function( $variation ) { + collect( $data[ 'variations' ] )->each( function ( $variation ) { if ( $this->getProductUsingBarcode( $variation[ 'barcode' ] ) ) { throw new Exception( sprintf( __( 'A variation within the product has a barcode which is already in use : %s.' ), $variation[ 'barcode' ] ) ); } @@ -529,7 +529,7 @@ public function saveGallery( Product $product, $groups ) { $product->galleries() ->get() - ->each( function( $image ) { + ->each( function ( $image ) { $image->delete(); }); @@ -539,15 +539,15 @@ public function saveGallery( Product $product, $groups ) * * @todo should be tested */ - $manyPrimary = collect( $groups )->map( function( $fields ) { + $manyPrimary = collect( $groups )->map( function ( $fields ) { return isset( $fields[ 'featured' ] ) && (int) $fields[ 'featured' ] === 1; }) ->filter( fn( $result ) => $result === true ) ->count() > 1; if ( $manyPrimary ) { - $groups = collect( $groups )->map( function( $fields, $index ) { - return collect( $fields )->map( function( $field, $fieldName ) use ( $index ) { + $groups = collect( $groups )->map( function ( $fields, $index ) { + return collect( $fields )->map( function ( $field, $fieldName ) use ( $index ) { if ( $fieldName === 'featured' ) { if ( $index === 0 ) { $field = 1; @@ -586,7 +586,7 @@ public function updateVariableProduct( Product $product, $data ) * * @var Illuminate\Support\Collection */ - $valid = collect( $data[ 'variations' ] )->filter( function( $product ) { + $valid = collect( $data[ 'variations' ] )->filter( function ( $product ) { return ! empty( $product[ 'id' ] ); }); @@ -600,7 +600,7 @@ public function updateVariableProduct( Product $product, $data ) ); } - $valid->each( function( $variation ) { + $valid->each( function ( $variation ) { if ( $foundProduct = $this->getProductUsingBarcode( $variation[ 'barcode' ] ) ) { if ( $foundProduct->id !== $variation[ 'id' ] ) { throw new Exception( sprintf( __( 'A variation within the product has a barcode which is already in use : %s.' ), $variation[ 'barcode' ] ) ); @@ -745,7 +745,7 @@ public function refreshPrices( ProductUnitQuantity $product ) public function getQuantity( $product_id, $unit_id ) { $unitQuantities = $this->get( $product_id )->unit_quantities; - $filtredQuantities = $unitQuantities->filter( function( $quantity ) use ( $unit_id ) { + $filtredQuantities = $unitQuantities->filter( function ( $quantity ) use ( $unit_id ) { return (int) $quantity->unit_id === (int) $unit_id; }); @@ -874,7 +874,7 @@ public function resetProduct( $product_id ) * product */ if ( $product->product_type === 'variable' ) { - $result = $product->variations->map( function( Product $product ) { + $result = $product->variations->map( function ( Product $product ) { return $this->__resetProductRelatives( $product ); })->toArray(); @@ -1008,7 +1008,7 @@ public function getUnitQuantities( $product_id ) { return ProductUnitQuantity::withProduct( $product_id ) ->get() - ->map( function( $productQuantity ) { + ->map( function ( $productQuantity ) { $productQuantity->unit; return $productQuantity; @@ -1030,7 +1030,7 @@ public function getUnitQuantity( $product_id, $unit_id ) */ public function getProductHistory( $product_id ) { - return ProductHistory::withProduct( $product_id )->orderBy( 'id' )->get()->map( function( $product ) { + return ProductHistory::withProduct( $product_id )->orderBy( 'id' )->get()->map( function ( $product ) { $product->unit; return $product; @@ -1169,7 +1169,7 @@ private function handleStockAdjustmentsForGroupedProducts( { $product->load( 'sub_items' ); - $products = $product->sub_items->map( function( ProductSubItem $subItem ) use ( $action, $orderProductQuantity, $parentUnit, $orderProduct ) { + $products = $product->sub_items->map( function ( ProductSubItem $subItem ) use ( $action, $orderProductQuantity, $parentUnit, $orderProduct ) { $finalQuantity = $this->computeSubItemQuantity( subItemQuantity: $subItem->quantity, parentUnit: $parentUnit, @@ -1414,7 +1414,7 @@ public function computeSubItemQuantity( Unit $parentUnit, float $parentQuantity ) { - return ( $subItemQuantity * $parentUnit->value ) * $parentQuantity; + return ( $subItemQuantity * $parentUnit->value ) * $parentQuantity; } /** @@ -1559,7 +1559,7 @@ public function deleteVariations( $id = null ) $variations = $this->getVariations( $id ); $count = $variations->count(); - $variations->map( function( $variation ) { + $variations->map( function ( $variation ) { event( new ProductBeforeDeleteEvent( $variation ) ); $variation->delete(); @@ -1587,7 +1587,7 @@ public function deleteVariations( $id = null ) */ public function deleteAllProducts() { - $result = $this->getProducts()->map( function( $product ) { + $result = $this->getProducts()->map( function ( $product ) { return $this->deleteProduct( $product ); })->toArray(); @@ -1621,8 +1621,8 @@ public function getLastPurchasePrice( $product, $before = null ) if ( $before ) { $request->where( 'created_at', '<=', $before ); } - - $procurementProduct = $request->first(); + + $procurementProduct = $request->first(); if ( $procurementProduct instanceof ProcurementProduct ) { return $procurementProduct->purchase_price; @@ -1764,7 +1764,7 @@ public function generateProductBarcode( Product $product ) $product->barcode_type ); - $product->unit_quantities->each( function( $unitQuantity ) use ( $product ) { + $product->unit_quantities->each( function ( $unitQuantity ) use ( $product ) { $this->barcodeService->generateBarcode( $unitQuantity->barcode, $product->barcode_type @@ -1779,15 +1779,15 @@ public function searchProduct( $search, $limit = 5, $arguments = [] ) */ $query = Product::query() ->searchable() - ->where( function( $query ) use ( $search ) { + ->where( function ( $query ) use ( $search ) { $query ->orWhere( 'name', 'LIKE', "%{$search}%" ) ->orWhere( 'sku', 'LIKE', "%{$search}%" ) ->orWhere( 'barcode', 'LIKE', "%{$search}%" ); }) - ->with([ + ->with([ 'unit_quantities.unit', - 'tax_group.taxes' + 'tax_group.taxes', ]) ->limit( $limit ); @@ -1801,13 +1801,13 @@ public function searchProduct( $search, $limit = 5, $arguments = [] ) $eloquenize->parse( $query, $arguments ); } - return $query->get() - ->map( function( $product ) { + return $query->get() + ->map( function ( $product ) { $units = json_decode( $product->purchase_unit_ids ); if ( $units ) { $product->purchase_units = collect(); - collect( $units )->each( function( $unitID ) use ( &$product ) { + collect( $units )->each( function ( $unitID ) use ( &$product ) { $product->purchase_units->push( Unit::find( $unitID ) ); }); } diff --git a/app/Services/ReportService.php b/app/Services/ReportService.php index 3a5a146f0..14c06e720 100644 --- a/app/Services/ReportService.php +++ b/app/Services/ReportService.php @@ -233,7 +233,7 @@ public function clearUnassignedCashFlow( $startAt, $endsAt ) ->where( 'created_at', '<=', $endsAt ) ->get(); - $cashFlows->each( function( $cashFlow ) { + $cashFlows->each( function ( $cashFlow ) { /** * let's clear unassigned to orders */ @@ -761,7 +761,7 @@ private function getBestRecords( $previousDates, $sort ) ->where( $orderTable . '.created_at', '<=', $report[ 'endDate' ] ) ->whereIn( $orderTable . '.payment_status', [ Order::PAYMENT_PAID ]) ->get() - ->map( function( $product ) { + ->map( function ( $product ) { $product->difference = 0; return $product; @@ -773,7 +773,7 @@ private function getBestRecords( $previousDates, $sort ) $default->total_price = 0; $default->quantity = 0; - $oldProduct = collect( $previousDates[ 'previous' ][ 'products' ] )->filter( function( $previousProduct ) use ( $product ) { + $oldProduct = collect( $previousDates[ 'previous' ][ 'products' ] )->filter( function ( $previousProduct ) use ( $product ) { return $previousProduct->product_id === $product->product_id; })->first() ?: $default; @@ -822,7 +822,7 @@ public function getSaleReport( $start, $end, $type, $user_id = null ) private function getSalesSummary( $orders ) { - $allSales = $orders->map( function( $order ) { + $allSales = $orders->map( function ( $order ) { return [ 'subtotal' => $order->subtotal, 'sales_discounts' => $order->discount, @@ -861,7 +861,7 @@ public function getProductsReports( $start, $end, $user_id = null ) $productsIds = $products->map( fn( $product ) => $product->product_id )->unique(); return [ - 'result' => $productsIds->map( function( $id ) use ( $products ) { + 'result' => $productsIds->map( function ( $id ) use ( $products ) { $product = $products->where( 'product_id', $id )->first(); $filtredProdcuts = $products->where( 'product_id', $id )->all(); @@ -910,7 +910,7 @@ public function getCategoryReports( $start, $end, $orderAttribute = 'name', $ord /** * That will sum all the total prices */ - $categories->each( function( $category ) use ( $products ) { + $categories->each( function ( $category ) use ( $products ) { $rawProducts = collect( $products->where( 'product_category_id', $category->id )->all() )->values(); $products = []; @@ -919,7 +919,7 @@ public function getCategoryReports( $start, $end, $orderAttribute = 'name', $ord * this will merge similar products * to summarize them. */ - $rawProducts->each( function( $product ) use ( &$products ) { + $rawProducts->each( function ( $product ) use ( &$products ) { if ( isset( $products[ $product->product_id ] ) ) { $products[ $product->product_id ][ 'quantity' ] += $product->quantity; $products[ $product->product_id ][ 'tax_value' ] += $product->tax_value; @@ -960,7 +960,7 @@ public function getCashierDashboard( $cashier, $startDate = null, $endDate = nul Cache::forget( $cacheKey ); } - return Cache::remember( $cacheKey, now()->addDay(1), function() use ( $startDate, $cashier, $endDate ) { + return Cache::remember( $cacheKey, now()->addDay(1), function () use ( $startDate, $cashier, $endDate ) { $startDate = $startDate === null ? ns()->date->getNow()->startOfDay()->toDateTimeString() : $startDate; $endDate = $endDate === null ? ns()->date->getNow()->endOfDay()->toDateTimeString() : $endDate; diff --git a/app/Services/SettingsPage.php b/app/Services/SettingsPage.php index 0d94c6f05..514843a8d 100644 --- a/app/Services/SettingsPage.php +++ b/app/Services/SettingsPage.php @@ -21,10 +21,10 @@ class SettingsPage */ public function getForm() { - return collect( $this->form )->mapWithKeys( function( $tab, $key ) { + return collect( $this->form )->mapWithKeys( function ( $tab, $key ) { if ( $tab === 'tabs' ) { return [ - $key => collect( $tab )->mapWithKeys( function( $tab, $key ) { + $key => collect( $tab )->mapWithKeys( function ( $tab, $key ) { /** * in case not fields is provided * let's save the tab with no fields. @@ -104,7 +104,7 @@ public function validateForm( Request $request ) /** * Let's properly flat everything. */ - $flatRules = collect( $isolatedRules )->mapWithKeys( function( $rule ) { + $flatRules = collect( $isolatedRules )->mapWithKeys( function ( $rule ) { return [ $rule[0] => $rule[1] ]; })->toArray(); diff --git a/app/Services/Setup.php b/app/Services/Setup.php index cadaf6051..1338b35e2 100644 --- a/app/Services/Setup.php +++ b/app/Services/Setup.php @@ -126,8 +126,8 @@ public function runMigration( $fields ) * root of the database folder. */ Artisan::call( 'migrate', [ - '--force' => true, - '--path' => 'database/migrations/2022_10_28_123458_setup_migration_table.php' + '--force' => true, + '--path' => 'database/migrations/2022_10_28_123458_setup_migration_table.php', ]); /** @@ -152,7 +152,7 @@ public function runMigration( $fields ) directories: [ 'core', 'create' ], ignoreMigrations: true ) - ->each( function( $file ) { + ->each( function ( $file ) { ns()->update->executeMigrationFromFileName( $file ); }); @@ -165,7 +165,7 @@ public function runMigration( $fields ) directories: [ 'update' ], ignoreMigrations: true ) - ->each( function( $file ) { + ->each( function ( $file ) { ns()->update->assumeExecuted( $file ); }); diff --git a/app/Services/TaxService.php b/app/Services/TaxService.php index b3245bf27..371b9d807 100644 --- a/app/Services/TaxService.php +++ b/app/Services/TaxService.php @@ -254,6 +254,7 @@ public function getComputedTaxGroupValue( $tax_type, $tax_group_id, $price ) if ( $taxGroup instanceof TaxGroup ) { $summarizedRate = $taxGroup->taxes->sum( 'rate' ); + return $this->getVatValue( $tax_type, $summarizedRate, $price ); } @@ -289,7 +290,7 @@ public function computeTax( ProductUnitQuantity $product, $tax_group_id, $tax_ty */ if ( $taxGroup instanceof TaxGroup ) { $taxRate = $taxGroup->taxes - ->map( function( $tax ) { + ->map( function ( $tax ) { return floatval( $tax[ 'rate' ] ); }) ->sum(); @@ -321,7 +322,7 @@ public function computeTax( ProductUnitQuantity $product, $tax_group_id, $tax_ty */ if ( $taxGroup instanceof TaxGroup ) { $taxRate = $taxGroup->taxes - ->map( function( $tax ) { + ->map( function ( $tax ) { return floatval( $tax[ 'rate' ] ); }) ->sum(); @@ -411,15 +412,15 @@ public function computeOrderProductTaxes( OrderProduct $orderProduct ) */ if ( $taxGroup instanceof TaxGroup ) { if ( $orderProduct->tax_type === 'exclusive' ) { - $orderProduct->price_with_tax = $orderProduct->unit_price; - $orderProduct->price_without_tax = $this->getPriceWithoutTaxUsingGroup( + $orderProduct->price_with_tax = $orderProduct->unit_price; + $orderProduct->price_without_tax = $this->getPriceWithoutTaxUsingGroup( type: 'inclusive', price: $orderProduct->price_with_tax - $discount, group: $taxGroup ); } else { - $orderProduct->price_without_tax = $orderProduct->unit_price; - $orderProduct->price_with_tax = $this->getPriceWithTaxUsingGroup( + $orderProduct->price_without_tax = $orderProduct->unit_price; + $orderProduct->price_with_tax = $this->getPriceWithTaxUsingGroup( type: 'exclusive', price: $orderProduct->price_without_tax - $discount, group: $taxGroup diff --git a/app/Services/TestService.php b/app/Services/TestService.php index 913a5b143..8eda4a485 100644 --- a/app/Services/TestService.php +++ b/app/Services/TestService.php @@ -26,7 +26,7 @@ public function prepareOrder( Carbon $date, array $orderDetails = [], array $pro $products = isset( $config[ 'products' ] ) ? $config[ 'products' ]() : Product::where( 'tax_group_id', '>', 0 ) ->where( 'type', '<>', Product::TYPE_GROUPED ) ->whereRelation( 'unit_quantities', 'quantity', '>', 1000 ) - ->with( 'unit_quantities', function( $query ) { + ->with( 'unit_quantities', function ( $query ) { $query->where( 'quantity', '>', 3 ); }) ->get() @@ -35,7 +35,7 @@ public function prepareOrder( Carbon $date, array $orderDetails = [], array $pro $shippingFees = $faker->randomElement([10, 15, 20, 25, 30, 35, 40]); $discountRate = $faker->numberBetween(0, 5); - $products = $products->map( function( $product ) use ( $faker, $productDetails, $config ) { + $products = $products->map( function ( $product ) use ( $faker, $productDetails, $config ) { $unitElement = $faker->randomElement( $product->unit_quantities ); $data = array_merge([ @@ -56,7 +56,7 @@ public function prepareOrder( Carbon $date, array $orderDetails = [], array $pro } return $data; - })->filter( function( $product ) { + })->filter( function ( $product ) { return $product[ 'quantity' ] > 0; }); @@ -65,7 +65,7 @@ public function prepareOrder( Carbon $date, array $orderDetails = [], array $pro */ $customer = Customer::get()->random(); - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) use ($currency) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) use ($currency) { return $currency ->define( $product[ 'unit_price' ] ) ->multiplyBy( $product[ 'quantity' ] ) @@ -167,8 +167,8 @@ public function prepareProcurement( Carbon $date, array $details = [] ) 'products' => Product::withStockEnabled() ->with( 'unitGroup' ) ->get() - ->map( function( $product ) { - return $product->unitGroup->units->map( function( $unit ) use ( $product ) { + ->map( function ( $product ) { + return $product->unitGroup->units->map( function ( $unit ) use ( $product ) { $unitQuantity = $product->unit_quantities->filter( fn( $q ) => (int) $q->unit_id === (int) $unit->id )->first(); return (object) [ @@ -177,7 +177,7 @@ public function prepareProcurement( Carbon $date, array $details = [] ) 'product' => $product, ]; }); - })->flatten()->map( function( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker ) { + })->flatten()->map( function ( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker ) { $quantity = $faker->numberBetween(1000000, 9000000); return [ diff --git a/app/Services/UnitService.php b/app/Services/UnitService.php index c46de84b4..3f342e047 100644 --- a/app/Services/UnitService.php +++ b/app/Services/UnitService.php @@ -87,7 +87,7 @@ public function createUnit( $data ) * other units changes */ if ( $data[ 'base_unit' ] === true ) { - $group->units->map( function( $unit ) { + $group->units->map( function ( $unit ) { $unit->base_unit = false; $unit->save(); }); @@ -171,7 +171,7 @@ public function updateUnit( $id, $fields ) * other units changes */ if ( $fields[ 'base_unit' ] === true ) { - $group->units->map( function( $unit ) use ( $id ) { + $group->units->map( function ( $unit ) use ( $id ) { if ( $unit->id !== $id ) { $unit->base_unit = false; $unit->save(); @@ -218,7 +218,7 @@ public function getBaseUnit( UnitGroup $group ) $baseUnit = UnitGroup::find( $group->id ) ->units() ->get() - ->filter( function( $unit ) { + ->filter( function ( $unit ) { return $unit->base_unit; }); diff --git a/app/Services/UpdateService.php b/app/Services/UpdateService.php index 0f74ed62d..52f4ae6cc 100644 --- a/app/Services/UpdateService.php +++ b/app/Services/UpdateService.php @@ -28,10 +28,10 @@ public function getMigrations( $ignoreMigrations = false, $directories = [ 'crea $migrations = Migration::get()->map( fn( $migration ) => $migration->migration ); } - return collect( $directories )->map( function( $directory ) { + return collect( $directories )->map( function ( $directory ) { $files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations/' . $directory ) ) ->filter( fn( $file ) => pathinfo( $file )[ 'extension' ] === 'php' ) - ->map( function( $file ) { + ->map( function ( $file ) { $fileInfo = pathinfo( $file ); return $fileInfo[ 'filename' ]; @@ -80,7 +80,7 @@ public function getMatchingFullPath( $file ) { $files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations' ) ) ->filter( fn( $file ) => pathinfo( $file )[ 'extension' ] === 'php' ) - ->mapWithKeys( function( $file ) { + ->mapWithKeys( function ( $file ) { $fileInfo = pathinfo( $file ); return [ $fileInfo[ 'filename' ] => $file ]; diff --git a/app/Services/Users.php b/app/Services/Users.php index 24e683c9f..77faf20cd 100644 --- a/app/Services/Users.php +++ b/app/Services/Users.php @@ -59,7 +59,7 @@ public function setUser( $attributes, $user = null ) collect([ 'username' => fn() => User::where( 'username', $attributes[ 'username' ] ), 'email' => fn() => User::where( 'email', $attributes[ 'email' ] ), - ])->each( function( $callback, $key ) use ( $user ) { + ])->each( function ( $callback, $key ) use ( $user ) { $query = $callback(); if ( $user instanceof User ) { diff --git a/app/Services/Validation.php b/app/Services/Validation.php index dbfa265de..835db865c 100644 --- a/app/Services/Validation.php +++ b/app/Services/Validation.php @@ -33,7 +33,7 @@ public function extract( $method, $model = null ) if ( class_exists( $this->class ) ) { $object = new $this->class; $fields = $object->$method( $model ); - $validation = collect( $fields )->mapWithKeys( function( $field ) { + $validation = collect( $fields )->mapWithKeys( function ( $field ) { return [ $field->name => ! empty( $field->validation ) ? $field->validation : '', ]; diff --git a/app/Settings/GeneralSettings.php b/app/Settings/GeneralSettings.php index 5ee39fe8a..2a5984d1b 100644 --- a/app/Settings/GeneralSettings.php +++ b/app/Settings/GeneralSettings.php @@ -163,7 +163,7 @@ public function __construct() 'value' => ns()->option->get( 'ns_currency_precision', '0' ), 'label' => __( 'Currency Precision' ), 'type' => 'select', - 'options' => collect([0, 1, 2, 3, 4, 5])->map( function( $index ) { + 'options' => collect([0, 1, 2, 3, 4, 5])->map( function ( $index ) { return [ 'label' => sprintf( __( '%s numbers after the decimal' ), $index ), 'value' => $index, diff --git a/app/Settings/orders/general.php b/app/Settings/orders/general.php index 7720a50a4..75c2c0b7b 100644 --- a/app/Settings/orders/general.php +++ b/app/Settings/orders/general.php @@ -42,7 +42,7 @@ 'name' => 'ns_orders_quotation_expiration', 'value' => ns()->option->get( 'ns_orders_quotation_expiration' ), 'description' => __( 'Quotations will get deleted after they defined they has reached.' ), - 'options' => Helper::kvToJsOptions( collect([3, 5, 10, 15, 30])->mapWithKeys( function( $days ) { + 'options' => Helper::kvToJsOptions( collect([3, 5, 10, 15, 30])->mapWithKeys( function ( $days ) { return [ $days => sprintf( __( '%s Days' ), $days ), ]; diff --git a/app/Settings/workers/general.php b/app/Settings/workers/general.php index 673ce67ee..e856eab61 100644 --- a/app/Settings/workers/general.php +++ b/app/Settings/workers/general.php @@ -15,7 +15,7 @@ 'no' => __( 'No' ), 'await_confirm' => __( 'Test' ), 'yes' => __( 'Yes' ), - ]) )->map( function( $option ) { + ]) )->map( function ( $option ) { $option[ 'disabled' ] = false; if ( $option[ 'value' ] === 'yes' ) { $option[ 'disabled' ] = true; diff --git a/config/sanctum.php b/config/sanctum.php index 529cfdc99..a1a68420b 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -41,8 +41,8 @@ |-------------------------------------------------------------------------- | | This value controls the number of minutes until an issued token will be - | considered expired. If this value is null, personal access tokens do - | not expire. This won't tweak the lifetime of first-party sessions. + | considered expired. This will override any values set in the token's + | "expires_at" attribute, but first-party sessions are not affected. | */ diff --git a/database/migrations/2022_10_28_123458_setup_migration_table.php b/database/migrations/2022_10_28_123458_setup_migration_table.php index 1214004f9..7c6a22e0d 100644 --- a/database/migrations/2022_10_28_123458_setup_migration_table.php +++ b/database/migrations/2022_10_28_123458_setup_migration_table.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'migrations' ) ) { - Schema::table( 'migrations', function( Blueprint $table ) { + Schema::table( 'migrations', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'migrations', 'type' ) ) { $table->string( 'type' )->default( 'core' ); } @@ -30,7 +30,7 @@ public function up() public function down() { if ( Schema::hasTable( 'migrations' ) ) { - Schema::table( 'migrations', function( Blueprint $table ) { + Schema::table( 'migrations', function ( Blueprint $table ) { if ( Schema::hasColumn( 'migrations', 'type' ) ) { $table->dropColumn( 'type' ); } diff --git a/database/migrations/core/2020_11_11_151614_nov11_create_nexopos_users_attributes_table.php b/database/migrations/core/2020_11_11_151614_nov11_create_nexopos_users_attributes_table.php index a9779f567..78c7e7cf2 100644 --- a/database/migrations/core/2020_11_11_151614_nov11_create_nexopos_users_attributes_table.php +++ b/database/migrations/core/2020_11_11_151614_nov11_create_nexopos_users_attributes_table.php @@ -24,7 +24,7 @@ public function runOnMultiStore() public function up() { if ( ! Schema::hasTable( 'nexopos_users_attributes' ) ) { - Schema::create( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::create( 'nexopos_users_attributes', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'user_id' ); $table->string( 'first_name' )->nullable(); diff --git a/database/migrations/core/2020_11_25_203531_nov25_fix_report_permissions_attribution.php b/database/migrations/core/2020_11_25_203531_nov25_fix_report_permissions_attribution.php index e11b6f3b2..1304d26e2 100644 --- a/database/migrations/core/2020_11_25_203531_nov25_fix_report_permissions_attribution.php +++ b/database/migrations/core/2020_11_25_203531_nov25_fix_report_permissions_attribution.php @@ -25,7 +25,7 @@ public function up() { Permission::where( 'namespace', 'like', '%.report.%' ) ->get() - ->each( function( $permission ) { + ->each( function ( $permission ) { $permission->namespace = str_replace( '.report.', '.reports.', $permission->namespace ); $permission->save(); }); diff --git a/database/migrations/core/2021_07_31_153029_update_dashboard_days_report_jul31.php b/database/migrations/core/2021_07_31_153029_update_dashboard_days_report_jul31.php index e3cb166c5..845c44923 100644 --- a/database/migrations/core/2021_07_31_153029_update_dashboard_days_report_jul31.php +++ b/database/migrations/core/2021_07_31_153029_update_dashboard_days_report_jul31.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_dashboard_days', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_days', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_dashboard_days', 'total_cashin' ) ) { $table->float( 'total_other_cashin' )->default(0); } diff --git a/database/migrations/create/2020_06_20_000000_create_customers_groups_table.php b/database/migrations/create/2020_06_20_000000_create_customers_groups_table.php index 9f49ab628..4acfd1783 100644 --- a/database/migrations/create/2020_06_20_000000_create_customers_groups_table.php +++ b/database/migrations/create/2020_06_20_000000_create_customers_groups_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_customers_groups' ) ) { - Schema::createIfMissing( 'nexopos_customers_groups', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_customers_groups', function ( Blueprint $table ) { $table->bigIncrements('id'); $table->string( 'name' ); $table->text( 'description' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_customers_metas_table.php b/database/migrations/create/2020_06_20_000000_create_customers_metas_table.php index 23f03d94a..36fc2f614 100644 --- a/database/migrations/create/2020_06_20_000000_create_customers_metas_table.php +++ b/database/migrations/create/2020_06_20_000000_create_customers_metas_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_customers_metas' ) ) { - Schema::createIfMissing( 'nexopos_customers_metas', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_customers_metas', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'customer_id' ); $table->string( 'key' ); diff --git a/database/migrations/create/2020_06_20_000000_create_customers_table.php b/database/migrations/create/2020_06_20_000000_create_customers_table.php index d83ad10ef..ce6b4f49d 100644 --- a/database/migrations/create/2020_06_20_000000_create_customers_table.php +++ b/database/migrations/create/2020_06_20_000000_create_customers_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_customers' ) ) { - Schema::createIfMissing( 'nexopos_customers', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_customers', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'surname' )->nullable(); @@ -39,7 +39,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_customers_addresses' ) ) { - Schema::createIfMissing( 'nexopos_customers_addresses', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_customers_addresses', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'customer_id' ); $table->string( 'type' ); // either "billing" | "shipping" @@ -60,7 +60,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_customers_account_history' ) ) { - Schema::createIfMissing( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_customers_account_history', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'customer_id' ); $table->integer( 'order_id' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_expenses_categories_table.php b/database/migrations/create/2020_06_20_000000_create_expenses_categories_table.php index c8344f51e..2d57f5928 100644 --- a/database/migrations/create/2020_06_20_000000_create_expenses_categories_table.php +++ b/database/migrations/create/2020_06_20_000000_create_expenses_categories_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_expenses_categories' ) ) { - Schema::createIfMissing( 'nexopos_expenses_categories', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_expenses_categories', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'operation' )->default( 'debit' ); // "credit" or "debit". diff --git a/database/migrations/create/2020_06_20_000000_create_expenses_table.php b/database/migrations/create/2020_06_20_000000_create_expenses_table.php index db0738af9..005779348 100644 --- a/database/migrations/create/2020_06_20_000000_create_expenses_table.php +++ b/database/migrations/create/2020_06_20_000000_create_expenses_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_expenses' ) ) { - Schema::createIfMissing( 'nexopos_expenses', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_expenses', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->integer( 'category_id' ); diff --git a/database/migrations/create/2020_06_20_000000_create_orders_addresses_table.php b/database/migrations/create/2020_06_20_000000_create_orders_addresses_table.php index 49c69a1a0..474d24e04 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_addresses_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_addresses_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders_addresses' ) ) { - Schema::createIfMissing( 'nexopos_orders_addresses', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_addresses', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'order_id' ); $table->string( 'type' ); // either "billing" or "shipping" diff --git a/database/migrations/create/2020_06_20_000000_create_orders_coupons_table.php b/database/migrations/create/2020_06_20_000000_create_orders_coupons_table.php index 24fa15623..c99b166f0 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_coupons_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_coupons_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders_coupons' ) ) { - Schema::createIfMissing( 'nexopos_orders_coupons', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_coupons', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'code' ); $table->string( 'name' ); diff --git a/database/migrations/create/2020_06_20_000000_create_orders_metas_table.php b/database/migrations/create/2020_06_20_000000_create_orders_metas_table.php index b81b4ef32..49a386743 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_metas_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_metas_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders_metas' ) ) { - Schema::createIfMissing( 'nexopos_orders_metas', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_metas', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'order_id' ); $table->string( 'key' ); diff --git a/database/migrations/create/2020_06_20_000000_create_orders_payment_table.php b/database/migrations/create/2020_06_20_000000_create_orders_payment_table.php index 30e8907f2..802d9b5bd 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_payment_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_payment_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders_payments' ) ) { - Schema::createIfMissing( 'nexopos_orders_payments', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_payments', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'order_id' ); $table->float( 'value', 18, 5 )->default(0); diff --git a/database/migrations/create/2020_06_20_000000_create_orders_products_table.php b/database/migrations/create/2020_06_20_000000_create_orders_products_table.php index 3a9505673..999afcb61 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_products_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_products_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders_products' ) ) { - Schema::createIfMissing( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_products', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'unit_name' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_orders_table.php b/database/migrations/create/2020_06_20_000000_create_orders_table.php index 4f69a8f19..60c775554 100644 --- a/database/migrations/create/2020_06_20_000000_create_orders_table.php +++ b/database/migrations/create/2020_06_20_000000_create_orders_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_orders' ) ) { - Schema::createIfMissing( 'nexopos_orders', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->text( 'description' )->nullable(); $table->string( 'code' ); @@ -59,7 +59,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_orders_count' ) ) { - Schema::createIfMissing( 'nexopos_orders_count', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_count', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'count' ); $table->datetime( 'date' ); @@ -67,7 +67,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_orders_taxes' ) ) { - Schema::createIfMissing( 'nexopos_orders_taxes', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_taxes', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'tax_id' )->nullable(); $table->integer( 'order_id' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_procurements_products_table.php b/database/migrations/create/2020_06_20_000000_create_procurements_products_table.php index f67dd5f17..8f310d818 100644 --- a/database/migrations/create/2020_06_20_000000_create_procurements_products_table.php +++ b/database/migrations/create/2020_06_20_000000_create_procurements_products_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_procurements_products' ) ) { - Schema::createIfMissing( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_procurements_products', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->float( 'gross_purchase_price', 18, 5 )->default(0); diff --git a/database/migrations/create/2020_06_20_000000_create_procurements_table.php b/database/migrations/create/2020_06_20_000000_create_procurements_table.php index b57cc17b2..606fbf657 100644 --- a/database/migrations/create/2020_06_20_000000_create_procurements_table.php +++ b/database/migrations/create/2020_06_20_000000_create_procurements_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_procurements' ) ) { - Schema::createIfMissing( 'nexopos_procurements', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_procurements', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->integer( 'provider_id' ); diff --git a/database/migrations/create/2020_06_20_000000_create_products_categories_table.php b/database/migrations/create/2020_06_20_000000_create_products_categories_table.php index 11a504aa0..aa1e71c63 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_categories_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_categories_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_categories' ) ) { - Schema::createIfMissing( 'nexopos_products_categories', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_categories', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->integer( 'parent_id' )->default(0)->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_products_gallery_table.php b/database/migrations/create/2020_06_20_000000_create_products_gallery_table.php index b4601e5cb..8c523a149 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_gallery_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_gallery_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_galleries' ) ) { - Schema::createIfMissing( 'nexopos_products_galleries', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_galleries', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' )->nullable(); $table->integer( 'product_id' ); diff --git a/database/migrations/create/2020_06_20_000000_create_products_history_table.php b/database/migrations/create/2020_06_20_000000_create_products_history_table.php index 594fe0a25..d7f4e6e0f 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_history_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_history_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_histories' ) ) { - Schema::createIfMissing( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_histories', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'product_id' ); $table->integer( 'procurement_id' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_products_metas_table.php b/database/migrations/create/2020_06_20_000000_create_products_metas_table.php index 071250fa0..5702ae797 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_metas_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_metas_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_metas' ) ) { - Schema::createIfMissing( 'nexopos_products_metas', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_metas', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'product_id' ); $table->string( 'key' ); diff --git a/database/migrations/create/2020_06_20_000000_create_products_table.php b/database/migrations/create/2020_06_20_000000_create_products_table.php index 440f86273..8fa64d26f 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products' ) ) { - Schema::createIfMissing( 'nexopos_products', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'tax_type' )->nullable(); // inclusive, exclusive diff --git a/database/migrations/create/2020_06_20_000000_create_products_taxes_table.php b/database/migrations/create/2020_06_20_000000_create_products_taxes_table.php index de6c16275..31f201614 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_taxes_table.php +++ b/database/migrations/create/2020_06_20_000000_create_products_taxes_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_taxes' ) ) { - Schema::createIfMissing( 'nexopos_products_taxes', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_taxes', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'product_id' ); $table->integer( 'unit_quantity_id' ); diff --git a/database/migrations/create/2020_06_20_000000_create_products_unit_quantities.php b/database/migrations/create/2020_06_20_000000_create_products_unit_quantities.php index 8843888a1..7c68cd60a 100644 --- a/database/migrations/create/2020_06_20_000000_create_products_unit_quantities.php +++ b/database/migrations/create/2020_06_20_000000_create_products_unit_quantities.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_products_unit_quantities' ) ) { - Schema::createIfMissing( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'product_id' ); $table->string( 'type' )->default( 'product' ); // product | variation diff --git a/database/migrations/create/2020_06_20_000000_create_providers_table.php b/database/migrations/create/2020_06_20_000000_create_providers_table.php index 2b6567a14..600edb833 100644 --- a/database/migrations/create/2020_06_20_000000_create_providers_table.php +++ b/database/migrations/create/2020_06_20_000000_create_providers_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_providers' ) ) { - Schema::createIfMissing( 'nexopos_providers', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_providers', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'surname' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_registers_history_table.php b/database/migrations/create/2020_06_20_000000_create_registers_history_table.php index 7dd1e8b17..76ae07a64 100644 --- a/database/migrations/create/2020_06_20_000000_create_registers_history_table.php +++ b/database/migrations/create/2020_06_20_000000_create_registers_history_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_registers_history' ) ) { - Schema::createIfMissing( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_registers_history', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'register_id' ); $table->integer( 'payment_id' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_registers_table.php b/database/migrations/create/2020_06_20_000000_create_registers_table.php index 271f1dc9d..2931ec9ae 100644 --- a/database/migrations/create/2020_06_20_000000_create_registers_table.php +++ b/database/migrations/create/2020_06_20_000000_create_registers_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_registers' ) ) { - Schema::createIfMissing( 'nexopos_registers', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_registers', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'status' )->default( 'closed' ); // open, closed, disabled diff --git a/database/migrations/create/2020_06_20_000000_create_rewards_system_rules_table.php b/database/migrations/create/2020_06_20_000000_create_rewards_system_rules_table.php index 1394c9abd..e9d42c716 100644 --- a/database/migrations/create/2020_06_20_000000_create_rewards_system_rules_table.php +++ b/database/migrations/create/2020_06_20_000000_create_rewards_system_rules_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_rewards_system_rules' ) ) { - Schema::createIfMissing( 'nexopos_rewards_system_rules', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_rewards_system_rules', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->float( 'from', 18, 5 ); $table->float( 'to', 18, 5 ); diff --git a/database/migrations/create/2020_06_20_000000_create_rewards_system_table.php b/database/migrations/create/2020_06_20_000000_create_rewards_system_table.php index 6f78bb37b..e1fb140df 100644 --- a/database/migrations/create/2020_06_20_000000_create_rewards_system_table.php +++ b/database/migrations/create/2020_06_20_000000_create_rewards_system_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_rewards_system' ) ) { - Schema::createIfMissing( 'nexopos_rewards_system', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_rewards_system', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'author' ); $table->string( 'name' ); diff --git a/database/migrations/create/2020_06_20_000000_create_taxes_table.php b/database/migrations/create/2020_06_20_000000_create_taxes_table.php index cd54e7207..42d2b798a 100644 --- a/database/migrations/create/2020_06_20_000000_create_taxes_table.php +++ b/database/migrations/create/2020_06_20_000000_create_taxes_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_taxes' ) ) { - Schema::createIfMissing( 'nexopos_taxes', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_taxes', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->text( 'description' )->nullable(); @@ -30,7 +30,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_taxes_groups' ) ) { - Schema::createIfMissing( 'nexopos_taxes_groups', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_taxes_groups', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->text( 'description' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_units_group_table.php b/database/migrations/create/2020_06_20_000000_create_units_group_table.php index 21e4978eb..08f767eac 100644 --- a/database/migrations/create/2020_06_20_000000_create_units_group_table.php +++ b/database/migrations/create/2020_06_20_000000_create_units_group_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_units_groups' ) ) { - Schema::createIfMissing( 'nexopos_units_groups', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_units_groups', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->text( 'description' )->nullable(); diff --git a/database/migrations/create/2020_06_20_000000_create_units_table.php b/database/migrations/create/2020_06_20_000000_create_units_table.php index 30c6b995c..131d0ee69 100644 --- a/database/migrations/create/2020_06_20_000000_create_units_table.php +++ b/database/migrations/create/2020_06_20_000000_create_units_table.php @@ -17,7 +17,7 @@ public function up() { if ( ! Schema::hasTable( 'nexopos_units' ) ) { - Schema::createIfMissing( 'nexopos_units', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_units', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'name' ); $table->string( 'identifier' )->unique(); diff --git a/database/migrations/create/2020_10_10_224639_create_dashboard_table.php b/database/migrations/create/2020_10_10_224639_create_dashboard_table.php index d77a49794..2b182ddf6 100644 --- a/database/migrations/create/2020_10_10_224639_create_dashboard_table.php +++ b/database/migrations/create/2020_10_10_224639_create_dashboard_table.php @@ -84,7 +84,7 @@ public function up() } if ( ! Schema::hasTable( 'nexopos_dashboard_weeks' ) ) { - Schema::createIfMissing( 'nexopos_dashboard_weeks', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_dashboard_weeks', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_dashboard_weeks', 'id' ) ) { $table->bigIncrements( 'id' ); } @@ -92,7 +92,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_dashboard_weeks' ) ) { - Schema::table( 'nexopos_dashboard_weeks', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_weeks', function ( Blueprint $table ) { foreach ([ 'total_gross_income', 'total_taxes', diff --git a/database/migrations/create/2020_11_17_120204_nov17_add_fields_to_nexopos_orders_products_table.php b/database/migrations/create/2020_11_17_120204_nov17_add_fields_to_nexopos_orders_products_table.php index 251b8063c..6a3a3c4a0 100644 --- a/database/migrations/create/2020_11_17_120204_nov17_add_fields_to_nexopos_orders_products_table.php +++ b/database/migrations/create/2020_11_17_120204_nov17_add_fields_to_nexopos_orders_products_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::createIfMissing( 'nexopos_orders_refunds', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_refunds', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->integer( 'order_id' ); $table->integer( 'author' ); diff --git a/database/migrations/create/2021_02_21_144532_create_orders_instalments_table.php b/database/migrations/create/2021_02_21_144532_create_orders_instalments_table.php index 8fe655477..937c0096e 100644 --- a/database/migrations/create/2021_02_21_144532_create_orders_instalments_table.php +++ b/database/migrations/create/2021_02_21_144532_create_orders_instalments_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::createIfMissing( 'nexopos_orders_instalments', function( Blueprint $table ) { + Schema::createIfMissing( 'nexopos_orders_instalments', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->float( 'amount', 18, 5 )->default(0); $table->integer( 'order_id' )->nullable(); diff --git a/database/migrations/create/2021_02_23_004748_create_new_instalments_permissions.php b/database/migrations/create/2021_02_23_004748_create_new_instalments_permissions.php index 757dc656f..ffdc0b982 100644 --- a/database/migrations/create/2021_02_23_004748_create_new_instalments_permissions.php +++ b/database/migrations/create/2021_02_23_004748_create_new_instalments_permissions.php @@ -76,7 +76,7 @@ public function down() 'nexopos.update.orders-instalments', 'nexopos.read.orders-instalments', 'nexopos.delete.orders-instalments', - ])->each( function( $identifier ) { + ])->each( function ( $identifier ) { $permission = Permission::where( 'namespace', $identifier )->first(); diff --git a/database/migrations/create/2022_01_20_202253_create_user_role_relations_table.php b/database/migrations/create/2022_01_20_202253_create_user_role_relations_table.php index b3f672cd4..a3567cd13 100644 --- a/database/migrations/create/2022_01_20_202253_create_user_role_relations_table.php +++ b/database/migrations/create/2022_01_20_202253_create_user_role_relations_table.php @@ -36,10 +36,10 @@ public function up() } if ( Schema::hasColumn( 'nexopos_users', 'role_id' ) ) { - Role::get()->each( function( $role ) { + Role::get()->each( function ( $role ) { User::where( 'role_id', $role->id ) ->get() - ->each( function( $user ) use ( $role ) { + ->each( function ( $user ) use ( $role ) { $relation = new UserRoleRelation; $relation->user_id = $user->id; $relation->role_id = $role->id; diff --git a/database/migrations/update/2020_09_23_143752_update_nexo_p_o_s_customers_table.php b/database/migrations/update/2020_09_23_143752_update_nexo_p_o_s_customers_table.php index 99368561b..784b8b5c9 100644 --- a/database/migrations/update/2020_09_23_143752_update_nexo_p_o_s_customers_table.php +++ b/database/migrations/update/2020_09_23_143752_update_nexo_p_o_s_customers_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_customers', 'purchases_amount' ) ) { $table->float( 'purchases_amount' )->default(0); } @@ -30,7 +30,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers', 'purchases_amount' ) ) { $table->dropColumn( 'purchases_amount' ); } diff --git a/database/migrations/update/2020_09_28_195241_add_price_mode_on_orders_products_table.php b/database/migrations/update/2020_09_28_195241_add_price_mode_on_orders_products_table.php index 4daf88a4c..f87f1eb86 100644 --- a/database/migrations/update/2020_09_28_195241_add_price_mode_on_orders_products_table.php +++ b/database/migrations/update/2020_09_28_195241_add_price_mode_on_orders_products_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'mode' ) ) { $table->string( 'mode' )->default( 'normal' ); // can be wholesale } @@ -31,13 +31,13 @@ public function up() public function down() { if ( Schema::hascolumn( 'nexopos_orders_products', 'mode' ) ) { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { $table->dropColumn( 'mode' ); }); } if ( Schema::hascolumn( 'nexopos_orders_products', 'unit_name' ) ) { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { $table->dropColumn( 'unit_name' ); }); } diff --git a/database/migrations/update/2020_10_04_093235_update_customers_addresses.php b/database/migrations/update/2020_10_04_093235_update_customers_addresses.php index 2f9a073bb..7f1ba3635 100644 --- a/database/migrations/update/2020_10_04_093235_update_customers_addresses.php +++ b/database/migrations/update/2020_10_04_093235_update_customers_addresses.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_customers_addresses', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_addresses', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_customers_addresses', 'email' ) ) { $table->string( 'email' )->nullable(); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_customers_addresses', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_addresses', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nxopos_customers_addresses', 'email' ) ) { $table->dropColumn( 'email' ); } diff --git a/database/migrations/update/2020_10_04_164540_update_nexo_orders_table.php b/database/migrations/update/2020_10_04_164540_update_nexo_orders_table.php index 12da8ce6f..6bfc16814 100644 --- a/database/migrations/update/2020_10_04_164540_update_nexo_orders_table.php +++ b/database/migrations/update/2020_10_04_164540_update_nexo_orders_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders', 'tax_value' ) ) { $table->float( 'tax_value' )->default(0); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'tax_value' ) ) { $table->dropColumn( 'tax_value' ); } diff --git a/database/migrations/update/2020_10_04_172820_update_nexopos_products_table.php b/database/migrations/update/2020_10_04_172820_update_nexopos_products_table.php index c32b61568..600ab5e9e 100644 --- a/database/migrations/update/2020_10_04_172820_update_nexopos_products_table.php +++ b/database/migrations/update/2020_10_04_172820_update_nexopos_products_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products', 'wholesale_tax_value' ) ) { $table->float( 'wholesale_tax_value' )->default(0); } @@ -31,7 +31,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products', 'wholesale_tax_value' ) ) { $table->dropColumn( 'wholesale_tax_value' ); } diff --git a/database/migrations/update/2020_10_06_150048_nexopos_orders_products_table_oct1620.php b/database/migrations/update/2020_10_06_150048_nexopos_orders_products_table_oct1620.php index 9624dce06..00cfe26d3 100644 --- a/database/migrations/update/2020_10_06_150048_nexopos_orders_products_table_oct1620.php +++ b/database/migrations/update/2020_10_06_150048_nexopos_orders_products_table_oct1620.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'tax_id' ) ) { $table->renameColumn( 'tax_id', 'tax_group_id' ); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'tax_group_id' ) ) { $table->renameColumn( 'tax_group_id', 'tax_id' ); } diff --git a/database/migrations/update/2020_10_06_211500_update_orders_products_oct620_02.php b/database/migrations/update/2020_10_06_211500_update_orders_products_oct620_02.php index c119ebc81..48579824e 100644 --- a/database/migrations/update/2020_10_06_211500_update_orders_products_oct620_02.php +++ b/database/migrations/update/2020_10_06_211500_update_orders_products_oct620_02.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'discount_amount' ) ) { $table->renameColumn( 'discount_amount', 'discount' ); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'discount' ) ) { $table->renameColumn( 'discount', 'discount_amount' ); } diff --git a/database/migrations/update/2020_10_06_213544_update_orders_oct620.php b/database/migrations/update/2020_10_06_213544_update_orders_oct620.php index 139564ae1..e77cce2b0 100644 --- a/database/migrations/update/2020_10_06_213544_update_orders_oct620.php +++ b/database/migrations/update/2020_10_06_213544_update_orders_oct620.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'discount_rate' ) ) { $table->renameColumn( 'discount_rate', 'discount_percentage' ); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'discount_percentage' ) ) { $table->renameColumn( 'discount_percentage', 'discount_rate' ); } diff --git a/database/migrations/update/2020_10_08_023527_update_orders_table_oct8.php b/database/migrations/update/2020_10_08_023527_update_orders_table_oct8.php index 19329d390..4009cae18 100644 --- a/database/migrations/update/2020_10_08_023527_update_orders_table_oct8.php +++ b/database/migrations/update/2020_10_08_023527_update_orders_table_oct8.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders', 'subtotal' ) ) { $table->float( 'subtotal' )->default(0); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'subtotal' ) ) { $table->dropColumn( 'subtotal' ); } diff --git a/database/migrations/update/2020_10_08_024603_update_orders_products_table_oct8.php b/database/migrations/update/2020_10_08_024603_update_orders_products_table_oct8.php index 219dbad9e..0128adafb 100644 --- a/database/migrations/update/2020_10_08_024603_update_orders_products_table_oct8.php +++ b/database/migrations/update/2020_10_08_024603_update_orders_products_table_oct8.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'unit_id' ) ) { $table->float( 'unit_id' )->default(0); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'unit_id' ) ) { $table->dropColumn( 'unit_id' ); } diff --git a/database/migrations/update/2020_10_14_070344_update_nexopos_orders_payments_table_oct14.php b/database/migrations/update/2020_10_14_070344_update_nexopos_orders_payments_table_oct14.php index bb9dbf028..9d22c2e50 100644 --- a/database/migrations/update/2020_10_14_070344_update_nexopos_orders_payments_table_oct14.php +++ b/database/migrations/update/2020_10_14_070344_update_nexopos_orders_payments_table_oct14.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_payments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_payments', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_payments', 'namespace' ) ) { $table->renameColumn( 'namespace', 'identifier' ); } @@ -28,7 +28,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_orders_payments' ) ) { - Schema::table( 'nexopos_orders_payments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_payments', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_payments', 'identifier' ) ) { $table->renameColumn( 'identifier', 'namespace' ); } diff --git a/database/migrations/update/2020_10_15_132428_update_dashboard_days_table_oct15.php b/database/migrations/update/2020_10_15_132428_update_dashboard_days_table_oct15.php index 904ec82bc..1a34d2988 100644 --- a/database/migrations/update/2020_10_15_132428_update_dashboard_days_table_oct15.php +++ b/database/migrations/update/2020_10_15_132428_update_dashboard_days_table_oct15.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_dashboard_days', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_days', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_dashboard_days', 'day_of_year' ) ) { $table->integer( 'day_of_year' )->nullable(); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_dashboard_days', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_days', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_dashbaord_days', 'day_of_year' ) ) { $table->dropColumn( 'day_of_year' ); } diff --git a/database/migrations/update/2020_10_16_000832_adjust_nexopos_units_quantities_table_oct16.php b/database/migrations/update/2020_10_16_000832_adjust_nexopos_units_quantities_table_oct16.php index d47f036ae..a2f92ff93 100644 --- a/database/migrations/update/2020_10_16_000832_adjust_nexopos_units_quantities_table_oct16.php +++ b/database/migrations/update/2020_10_16_000832_adjust_nexopos_units_quantities_table_oct16.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { foreach ([ 'sale_price_tax', 'sale_price', @@ -48,7 +48,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { foreach ([ 'sale_price_tax', 'wholesale_price_tax', diff --git a/database/migrations/update/2020_10_16_150242_remove_useless_fields_nexopos_products_oct16.php b/database/migrations/update/2020_10_16_150242_remove_useless_fields_nexopos_products_oct16.php index a8dddae8f..98f3832dc 100644 --- a/database/migrations/update/2020_10_16_150242_remove_useless_fields_nexopos_products_oct16.php +++ b/database/migrations/update/2020_10_16_150242_remove_useless_fields_nexopos_products_oct16.php @@ -25,7 +25,7 @@ public function up() 'incl_tax_wholesale_price', 'excl_tax_wholesale_price', ] as $field ) { - Schema::table( 'nexopos_products', function( Blueprint $table ) use ( $field ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) use ( $field ) { if ( Schema::hasColumn( 'nexopos_products', $field ) ) { $table->dropColumn( $field ); } @@ -53,7 +53,7 @@ public function down() 'excl_tax_wholesale_price', ] as $field ) { if ( Schema::hasTable( 'nexopos_products' ) ) { - Schema::table( 'nexopos_products', function( Blueprint $table ) use ( $field ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) use ( $field ) { if ( ! Schema::hasColumn( 'nexopos_products', $field ) ) { $table->float( $field )->default(0); } diff --git a/database/migrations/update/2020_10_17_112201_update_product_taxes_table_oct17.php b/database/migrations/update/2020_10_17_112201_update_product_taxes_table_oct17.php index 91e2c6b86..6b769e35e 100644 --- a/database/migrations/update/2020_10_17_112201_update_product_taxes_table_oct17.php +++ b/database/migrations/update/2020_10_17_112201_update_product_taxes_table_oct17.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_products_taxes', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products_taxes', 'unit_quantity_id' ) ) { $table->integer( 'unit_quantity_id' ); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_products_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_products_taxes', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products_taxes', 'unit_quantity_id' ) ) { $table->dropColumn( 'unit_quantity_id' ); } diff --git a/database/migrations/update/2020_10_17_114645_update_nexopos_products_table_oct17.php b/database/migrations/update/2020_10_17_114645_update_nexopos_products_table_oct17.php index 69fbfa3f2..a7aa7adca 100644 --- a/database/migrations/update/2020_10_17_114645_update_nexopos_products_table_oct17.php +++ b/database/migrations/update/2020_10_17_114645_update_nexopos_products_table_oct17.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { foreach ([ 'selling_unit_ids', 'purchase_unit_ids', @@ -34,7 +34,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_products' ) ) { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { foreach ([ 'selling_unit_ids', 'purchase_unit_ids', diff --git a/database/migrations/update/2020_10_18_002033_update_nexopos_orders_products_oct18.php b/database/migrations/update/2020_10_18_002033_update_nexopos_orders_products_oct18.php index 3f7a00ecf..f5cfb55c4 100644 --- a/database/migrations/update/2020_10_18_002033_update_nexopos_orders_products_oct18.php +++ b/database/migrations/update/2020_10_18_002033_update_nexopos_orders_products_oct18.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'unit_quantity_id' ) ) { $table->float( 'unit_quantity_id' ); } @@ -31,7 +31,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'unit_quantity_id' ) ) { $table->dropColumn( 'unit_quantity_id' ); } diff --git a/database/migrations/update/2020_10_19_174955_update_nexopos_orders_storage_oct19.php b/database/migrations/update/2020_10_19_174955_update_nexopos_orders_storage_oct19.php index 882ad6064..40f75a1a9 100644 --- a/database/migrations/update/2020_10_19_174955_update_nexopos_orders_storage_oct19.php +++ b/database/migrations/update/2020_10_19_174955_update_nexopos_orders_storage_oct19.php @@ -15,13 +15,13 @@ public function up() { if ( Schema::hasTable( 'nexopos_orders_storage' ) ) { if ( Schema::hasColumn( 'nexopos_orders_storage', 'product_unit_quantity_id' ) ) { - Schema::table( 'nexopos_orders_storage', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_storage', function ( Blueprint $table ) { $table->renameColumn( 'product_unit_quantity_id', 'unit_quantity_id' ); }); } if ( Schema::hasColumn( 'nexopos_orders_storage', 'product_unit_id' ) ) { - Schema::table( 'nexopos_orders_storage', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_storage', function ( Blueprint $table ) { $table->renameColumn( 'product_unit_id', 'unit_id' ); }); } @@ -37,13 +37,13 @@ public function down() { if ( Schema::hasTable( 'nexopos_orders_storage' ) ) { if ( Schema::hasColumn( 'nexopos_orders_storage', 'unit_quantity_id' ) ) { - Schema::table( 'nexopos_orders_storage', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_storage', function ( Blueprint $table ) { $table->renameColumn( 'unit_quantity_id', 'product_unit_quantity_id' ); }); } if ( Schema::hasColumn( 'nexopos_orders_storage', 'unit_id' ) ) { - Schema::table( 'nexopos_orders_storage', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_storage', function ( Blueprint $table ) { $table->renameColumn( 'unit_id', 'product_unit_id' ); }); } diff --git a/database/migrations/update/2020_10_20_085336_update_nexopos_products_table_oct20.php b/database/migrations/update/2020_10_20_085336_update_nexopos_products_table_oct20.php index 3222dbe0f..4e95d75db 100644 --- a/database/migrations/update/2020_10_20_085336_update_nexopos_products_table_oct20.php +++ b/database/migrations/update/2020_10_20_085336_update_nexopos_products_table_oct20.php @@ -15,7 +15,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_products' ) ) { if ( ! Schema::hasColumn( 'nexopos_products', 'accurate_stock' ) ) { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { $table->boolean( 'accurate_stock' )->default(0); }); } @@ -31,7 +31,7 @@ public function down() { if ( Schema::hasTable( 'nexopos_products' ) ) { if ( Schema::hasColumn( 'nexopos_products', 'accurate_stock' ) ) { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { $table->dropColumn( 'accurate_stock' ); }); } diff --git a/database/migrations/update/2020_10_20_125912_update_nexopos_products_history_oct20.php b/database/migrations/update/2020_10_20_125912_update_nexopos_products_history_oct20.php index 987e865f1..d809de648 100644 --- a/database/migrations/update/2020_10_20_125912_update_nexopos_products_history_oct20.php +++ b/database/migrations/update/2020_10_20_125912_update_nexopos_products_history_oct20.php @@ -15,7 +15,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_products_histories' ) ) { if ( ! Schema::hasColumn( 'nexopos_products_histories', 'description' ) ) { - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { $table->text( 'description' )->nullable(); }); } @@ -31,7 +31,7 @@ public function down() { if ( Schema::hasTable( 'nexopos_products_histories' ) ) { if ( Schema::hasColumn( 'nexopos_products_histories', 'description' ) ) { - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { $table->dropColumn( 'description' ); }); } diff --git a/database/migrations/update/2020_10_29_233635_update_nexopos_expenses_table_oct30.php b/database/migrations/update/2020_10_29_233635_update_nexopos_expenses_table_oct30.php index dc84fb3dc..4ddc1f302 100644 --- a/database/migrations/update/2020_10_29_233635_update_nexopos_expenses_table_oct30.php +++ b/database/migrations/update/2020_10_29_233635_update_nexopos_expenses_table_oct30.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_expenses' ) ) { - Schema::table( 'nexopos_expenses', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_expenses', 'active' ) ) { $table->boolean( 'active' )->default(true); } @@ -30,7 +30,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_expenses' ) ) { - Schema::table( 'nexopos_expenses', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_expenses', 'active' ) ) { $table->dropColumn( 'active' ); } diff --git a/database/migrations/update/2020_11_04_081659_update_tables_column_types_nov4.php b/database/migrations/update/2020_11_04_081659_update_tables_column_types_nov4.php index 39c970eee..c9d9f9e01 100644 --- a/database/migrations/update/2020_11_04_081659_update_tables_column_types_nov4.php +++ b/database/migrations/update/2020_11_04_081659_update_tables_column_types_nov4.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_orders_products' ) ) { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_orders_products', [ 'quantity', 'discount_percentage', @@ -46,7 +46,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_orders' ) ) { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_orders', [ 'discount', 'discount_percentage', @@ -74,7 +74,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_orders_coupons' ) ) { - Schema::table( 'nexopos_orders_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_coupons', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_orders_coupons', [ 'value', ]) ) { @@ -84,7 +84,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_orders_taxes' ) ) { - Schema::table( 'nexopos_orders_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_taxes', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_orders_taxes', [ 'tax_value', ]) ) { @@ -94,7 +94,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_orders_payments' ) ) { - Schema::table( 'nexopos_orders_payments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_payments', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_orders_payments', [ 'value', ]) ) { @@ -104,7 +104,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_expenses_history' ) ) { - Schema::table( 'nexopos_expenses_history', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses_history', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_expenses_history', [ 'value', ]) ) { @@ -114,7 +114,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_expenses' ) ) { - Schema::table( 'nexopos_expenses', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_expenses', [ 'value', ]) ) { @@ -124,7 +124,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_dashboard_weeks' ) ) { - Schema::table( 'nexopos_dashboard_weeks', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_weeks', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_dashboard_weeks', [ 'total_gross_income', 'total_taxes', @@ -140,7 +140,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_customers_coupons' ) ) { - Schema::table( 'nexopos_customers_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_coupons', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_customers_coupons', [ 'discount_value', 'minimum_cart_value', @@ -156,7 +156,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_customers_account_history' ) ) { - Schema::table( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_account_history', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_customers_account_history', [ 'amount', ]) ) { @@ -166,7 +166,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_customers' ) ) { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_customers', [ 'purchases_amount', 'owed_amount', @@ -180,7 +180,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_dashboard_days' ) ) { - Schema::table( 'nexopos_dashboard_days', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_days', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_dashboard_days', [ 'total_unpaid_orders', 'day_unpaid_orders', @@ -236,7 +236,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_rewards_system' ) ) { - Schema::table( 'nexopos_rewards_system', function( Blueprint $table ) { + Schema::table( 'nexopos_rewards_system', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_rewards_system', [ 'target', ]) ) { @@ -246,7 +246,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_rewards_system_rules' ) ) { - Schema::table( 'nexopos_rewards_system_rules', function( Blueprint $table ) { + Schema::table( 'nexopos_rewards_system_rules', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_rewards_system_rules', [ 'from', 'to', @@ -260,7 +260,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_providers' ) ) { - Schema::table( 'nexopos_providers', function( Blueprint $table ) { + Schema::table( 'nexopos_providers', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_providers', [ 'amount_due', 'amount_paid', @@ -272,7 +272,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_products_taxes' ) ) { - Schema::table( 'nexopos_products_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_products_taxes', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_products_taxes', [ 'rate', 'value', @@ -284,7 +284,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_products_histories' ) ) { - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_products_histories', [ 'before_quantity', 'quantity', @@ -302,7 +302,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_registers_history' ) ) { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_registers_history', [ 'value', ]) ) { @@ -312,7 +312,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_transfers_products' ) ) { - Schema::table( 'nexopos_transfers_products', function( Blueprint $table ) { + Schema::table( 'nexopos_transfers_products', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_transfers_products', [ 'quantity', ]) ) { @@ -322,7 +322,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_procurements_products' ) ) { - Schema::table( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_products', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_procurements_products', [ 'gross_purchase_price', 'net_purchase_price', @@ -342,7 +342,7 @@ public function up() } if ( Schema::hasTable( 'nexopos_products_unit_quantities' ) ) { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( Schema::hasColumns( 'nexopos_products_unit_quantities', [ 'quantity', 'sale_price_tax', diff --git a/database/migrations/update/2020_11_05_144309_nov5_add_new_fields_on_nexopos_customers_account_history_table.php b/database/migrations/update/2020_11_05_144309_nov5_add_new_fields_on_nexopos_customers_account_history_table.php index a43cac682..90aa12537 100644 --- a/database/migrations/update/2020_11_05_144309_nov5_add_new_fields_on_nexopos_customers_account_history_table.php +++ b/database/migrations/update/2020_11_05_144309_nov5_add_new_fields_on_nexopos_customers_account_history_table.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_customers_account_history' ) ) { - Schema::table( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_account_history', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_customers_account_history', 'order_id' ) ) { $table->integer( 'order_id' )->nullable(); } @@ -30,7 +30,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_customers_account_history' ) ) { - Schema::table( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_account_history', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers_account_history', 'order_id' ) ) { $table->dropColumn( 'order_id' ); } diff --git a/database/migrations/update/2020_11_14_170843_nov14_fix_nexopos_orders_products_table.php b/database/migrations/update/2020_11_14_170843_nov14_fix_nexopos_orders_products_table.php index 1c6ae6ada..2b31d325b 100644 --- a/database/migrations/update/2020_11_14_170843_nov14_fix_nexopos_orders_products_table.php +++ b/database/migrations/update/2020_11_14_170843_nov14_fix_nexopos_orders_products_table.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'unit_id' ) ) { $table->integer( 'unit_id' )->change(); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'unit_id' ) ) { $table->float( 'unit_id' )->change(); } diff --git a/database/migrations/update/2020_11_28_233738_nov29_update_nexopos_orders_products_table.php b/database/migrations/update/2020_11_28_233738_nov29_update_nexopos_orders_products_table.php index 61834726a..59b4e846d 100644 --- a/database/migrations/update/2020_11_28_233738_nov29_update_nexopos_orders_products_table.php +++ b/database/migrations/update/2020_11_28_233738_nov29_update_nexopos_orders_products_table.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_orders_products' ) ) { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'total_purchase_price' ) ) { $table->float( 'total_purchase_price' )->default(0); } diff --git a/database/migrations/update/2020_12_09_103720_dec9_update_nexopos_products_histories.php b/database/migrations/update/2020_12_09_103720_dec9_update_nexopos_products_histories.php index c2ab54042..35268bf67 100644 --- a/database/migrations/update/2020_12_09_103720_dec9_update_nexopos_products_histories.php +++ b/database/migrations/update/2020_12_09_103720_dec9_update_nexopos_products_histories.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { $table->text( 'description' )->nullable()->change(); }); } diff --git a/database/migrations/update/2021_01_07_103716_set_used_by_nullable_registers_jan7.php b/database/migrations/update/2021_01_07_103716_set_used_by_nullable_registers_jan7.php index 8343bbcd4..10e74afd6 100644 --- a/database/migrations/update/2021_01_07_103716_set_used_by_nullable_registers_jan7.php +++ b/database/migrations/update/2021_01_07_103716_set_used_by_nullable_registers_jan7.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_registers', function( Blueprint $table ) { + Schema::table( 'nexopos_registers', function ( Blueprint $table ) { $table->integer( 'used_by' )->nullable()->change(); }); } diff --git a/database/migrations/update/2021_01_26_102828_update_nexopos_orders_coupons_table_janv26.php b/database/migrations/update/2021_01_26_102828_update_nexopos_orders_coupons_table_janv26.php index 6ced1570c..e8cfe6144 100644 --- a/database/migrations/update/2021_01_26_102828_update_nexopos_orders_coupons_table_janv26.php +++ b/database/migrations/update/2021_01_26_102828_update_nexopos_orders_coupons_table_janv26.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_coupons', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_coupons', 'code' ) ) { $table->string( 'code' ); } diff --git a/database/migrations/update/2021_01_26_103057_update_nexopos_orders_table_janv26.php b/database/migrations/update/2021_01_26_103057_update_nexopos_orders_table_janv26.php index 13283d665..dc27398c1 100644 --- a/database/migrations/update/2021_01_26_103057_update_nexopos_orders_table_janv26.php +++ b/database/migrations/update/2021_01_26_103057_update_nexopos_orders_table_janv26.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders', 'total_coupons' ) ) { $table->float( 'total_coupons' )->default(0); } diff --git a/database/migrations/update/2021_01_27_113038_update_customers_coupons_table_janv27.php b/database/migrations/update/2021_01_27_113038_update_customers_coupons_table_janv27.php index 66b8246a3..889bc7aab 100644 --- a/database/migrations/update/2021_01_27_113038_update_customers_coupons_table_janv27.php +++ b/database/migrations/update/2021_01_27_113038_update_customers_coupons_table_janv27.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_customers_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_coupons', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers_coupons', 'limit' ) ) { $table->renameColumn( 'limit', 'limit_usage' ); } diff --git a/database/migrations/update/2021_03_09_230627_update_products_table_march10.php b/database/migrations/update/2021_03_09_230627_update_products_table_march10.php index f1711941b..c5e7fcd99 100644 --- a/database/migrations/update/2021_03_09_230627_update_products_table_march10.php +++ b/database/migrations/update/2021_03_09_230627_update_products_table_march10.php @@ -13,19 +13,19 @@ */ public function up() { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products', 'accurate_tracking' ) ) { $table->boolean( 'accurate_tracking' )->default( false ); } }); - Schema::table( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_procurements_products', 'available_quantity' ) ) { $table->float( 'available_quantity', 8, 5 )->default(0); } }); - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products_unit_quantities', 'expiration_date' ) ) { $table->dropColumn( 'expiration_date' ); } @@ -39,19 +39,19 @@ public function up() */ public function down() { - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products', 'accurate_tracking' ) ) { $table->dropColumn( 'accurate_tracking' ); } }); - Schema::table( 'nexopos_procurements_prodcuts', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_prodcuts', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements_prodcuts', 'available_quantity' ) ) { $table->dropColumn( 'available_quantity' ); } }); - Schema::table( 'nexopos_procurements_prodcuts', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_prodcuts', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements_prodcuts', 'expiration_date' ) ) { $table->dropColumn( 'expiration_date' ); } diff --git a/database/migrations/update/2021_03_10_144031_update_orders_products_table_march10.php b/database/migrations/update/2021_03_10_144031_update_orders_products_table_march10.php index 728de04db..92586c68e 100644 --- a/database/migrations/update/2021_03_10_144031_update_orders_products_table_march10.php +++ b/database/migrations/update/2021_03_10_144031_update_orders_products_table_march10.php @@ -13,13 +13,13 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'procurement_product_id' ) ) { $table->integer( 'procurement_product_id' )->nullable(); } }); - Schema::table( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_procurements_products', 'barcode' ) ) { $table->string( 'barcode' )->nullable(); } @@ -33,13 +33,13 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'procurement_product_id' ) ) { $table->dropColumn( 'procurement_product_id' ); } }); - Schema::table( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements_products', 'barcode' ) ) { $table->dropColumn( 'barcode' ); } diff --git a/database/migrations/update/2021_03_14_121910_add_barcode_to_nexopos_products_unit_quantities_march14.php b/database/migrations/update/2021_03_14_121910_add_barcode_to_nexopos_products_unit_quantities_march14.php index 1e1e68ba8..0765cbfa8 100644 --- a/database/migrations/update/2021_03_14_121910_add_barcode_to_nexopos_products_unit_quantities_march14.php +++ b/database/migrations/update/2021_03_14_121910_add_barcode_to_nexopos_products_unit_quantities_march14.php @@ -20,7 +20,7 @@ public function up() } }); - ProductUnitQuantity::get()->each( function( ProductUnitQuantity $unitQuantity ) { + ProductUnitQuantity::get()->each( function ( ProductUnitQuantity $unitQuantity ) { $barcode = $unitQuantity->product->barcode; $unitQuantity->barcode = $barcode . '-' . $unitQuantity->id; $unitQuantity->save(); diff --git a/database/migrations/update/2021_03_18_011827_update_users_attributes_mar18.php b/database/migrations/update/2021_03_18_011827_update_users_attributes_mar18.php index be505bc59..7e6fce8e6 100644 --- a/database/migrations/update/2021_03_18_011827_update_users_attributes_mar18.php +++ b/database/migrations/update/2021_03_18_011827_update_users_attributes_mar18.php @@ -23,7 +23,7 @@ public function runOnMultiStore() */ public function up() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_users_attributes', 'avatar_link' ) ) { $table->string( 'avatar_link' )->nullable(); } @@ -37,7 +37,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_users_attributes', 'avatar_link' ) ) { $table->dropColumn( 'avatar_link' ); } diff --git a/database/migrations/update/2021_03_18_204134_update_nexopos_users_table_march18.php b/database/migrations/update/2021_03_18_204134_update_nexopos_users_table_march18.php index f00787b26..b6a055c1d 100644 --- a/database/migrations/update/2021_03_18_204134_update_nexopos_users_table_march18.php +++ b/database/migrations/update/2021_03_18_204134_update_nexopos_users_table_march18.php @@ -23,7 +23,7 @@ public function runOnMultiStore() */ public function up() { - Schema::table( 'nexopos_users', function( Blueprint $table ) { + Schema::table( 'nexopos_users', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_users', 'activation_token' ) ) { $table->string( 'activation_token' )->nullable(); } @@ -42,7 +42,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_users' ) ) { - Schema::table( 'nexopos_users', function( Blueprint $table ) { + Schema::table( 'nexopos_users', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_users', 'activation_token' ) ) { $table->dropColumn( 'activation_token' ); } diff --git a/database/migrations/update/2021_03_29_144938_update_value_lenghts_float_fields__mar29.php b/database/migrations/update/2021_03_29_144938_update_value_lenghts_float_fields__mar29.php index 3021aa610..1b35fa2e8 100644 --- a/database/migrations/update/2021_03_29_144938_update_value_lenghts_float_fields__mar29.php +++ b/database/migrations/update/2021_03_29_144938_update_value_lenghts_float_fields__mar29.php @@ -13,13 +13,13 @@ */ public function up() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements', 'value' ) ) { $table->float( 'value', 11, 4 )->change(); } }); - Schema::table( 'nexopos_providers', function( Blueprint $table ) { + Schema::table( 'nexopos_providers', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_providers', 'amount_due' ) ) { $table->float( 'amount_due', 11, 4 )->change(); } diff --git a/database/migrations/update/2021_03_30_194055_update_order_products_table_mar30.php b/database/migrations/update/2021_03_30_194055_update_order_products_table_mar30.php index 6c4efc2a0..1d69611b9 100644 --- a/database/migrations/update/2021_03_30_194055_update_order_products_table_mar30.php +++ b/database/migrations/update/2021_03_30_194055_update_order_products_table_mar30.php @@ -14,13 +14,13 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'product_category_id' ) ) { $table->integer( 'product_category_id' )->default(0); } }); - OrderProduct::get()->each( function( $product ) { + OrderProduct::get()->each( function ( $product ) { $product->product_category_id = $product->product->category->id ?? 0; $product->save(); }); @@ -33,7 +33,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'neoxpos_orders_products', 'product_category_id' ) ) { $table->dropColumn( 'product_category_id' ); } diff --git a/database/migrations/update/2021_05_09_130048_update_users_attributes_may9.php b/database/migrations/update/2021_05_09_130048_update_users_attributes_may9.php index 6deebdcdf..20345eeaa 100644 --- a/database/migrations/update/2021_05_09_130048_update_users_attributes_may9.php +++ b/database/migrations/update/2021_05_09_130048_update_users_attributes_may9.php @@ -23,7 +23,7 @@ public function runOnMultiStore() */ public function up() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_users_attributes', 'language' ) ) { $table->string( 'language' )->nullable(); } @@ -37,7 +37,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_users_attributes', 'language' ) ) { $table->dropColumn( 'language' ); } diff --git a/database/migrations/update/2021_07_04_192109_update_adjust_role_create_new_permissions.php b/database/migrations/update/2021_07_04_192109_update_adjust_role_create_new_permissions.php index 1555ec946..b04300477 100644 --- a/database/migrations/update/2021_07_04_192109_update_adjust_role_create_new_permissions.php +++ b/database/migrations/update/2021_07_04_192109_update_adjust_role_create_new_permissions.php @@ -35,7 +35,7 @@ public function up() $role->delete(); } - Schema::table( 'nexopos_roles', function( Blueprint $table ) { + Schema::table( 'nexopos_roles', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_roles', 'dashid' ) ) { $table->string( 'dashid' )->nullable()->default( 'default' ); } @@ -50,7 +50,7 @@ public function up() 'nexopos.store.administrator', ]) ->get() - ->each( function( $role ) { + ->each( function ( $role ) { $role->dashid = 'store'; $role->save(); }); @@ -63,7 +63,7 @@ public function up() 'nexopos.store.cashier', ]) ->get() - ->each( function( $role ) { + ->each( function ( $role ) { $role->dashid = 'cashier'; $role->save(); }); @@ -76,7 +76,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_roles', function( Blueprint $table ) { + Schema::table( 'nexopos_roles', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_roles', 'dashid' ) ) { $table->removeColumn( 'dashid' ); } diff --git a/database/migrations/update/2021_07_31_100843_update_nexopos_registers_history_jul31.php b/database/migrations/update/2021_07_31_100843_update_nexopos_registers_history_jul31.php index 6d806e7fe..68146dc6e 100644 --- a/database/migrations/update/2021_07_31_100843_update_nexopos_registers_history_jul31.php +++ b/database/migrations/update/2021_07_31_100843_update_nexopos_registers_history_jul31.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { $table->float( 'value' )->default(0)->change(); }); } diff --git a/database/migrations/update/2021_08_01_085619_update_add_columns_to_expense_history__aug1.php b/database/migrations/update/2021_08_01_085619_update_add_columns_to_expense_history__aug1.php index 110ad3be3..f984e6e25 100644 --- a/database/migrations/update/2021_08_01_085619_update_add_columns_to_expense_history__aug1.php +++ b/database/migrations/update/2021_08_01_085619_update_add_columns_to_expense_history__aug1.php @@ -61,7 +61,7 @@ public function up() */ Permission::includes( '.expenses-history' ) ->get() - ->each( function( $permission ) { + ->each( function ( $permission ) { $permission->removeFromRoles(); $permission->delete(); }); diff --git a/database/migrations/update/2021_08_01_125501_update_expense_category_aug1.php b/database/migrations/update/2021_08_01_125501_update_expense_category_aug1.php index 5b1814d00..ca11ec4a8 100644 --- a/database/migrations/update/2021_08_01_125501_update_expense_category_aug1.php +++ b/database/migrations/update/2021_08_01_125501_update_expense_category_aug1.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_expenses_categories' ) ) { - Schema::table( 'nexopos_expenses_categories', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses_categories', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_expenses_categories', 'operation' ) ) { $table->string( 'operation' )->default( 'debit' ); // "credit" or "debit". } @@ -33,7 +33,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_expenses_categories' ) ) { - Schema::table( 'nexopos_expenses_categories', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses_categories', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_expenses_categories', 'operation' ) ) { $table->dropColumn( 'operation' ); // "credit" or "debit". } diff --git a/database/migrations/update/2021_08_12_153954_update_add_taxto_order_refunds_products_aug12.php b/database/migrations/update/2021_08_12_153954_update_add_taxto_order_refunds_products_aug12.php index 6426e2d8b..ea93c7bff 100644 --- a/database/migrations/update/2021_08_12_153954_update_add_taxto_order_refunds_products_aug12.php +++ b/database/migrations/update/2021_08_12_153954_update_add_taxto_order_refunds_products_aug12.php @@ -13,13 +13,13 @@ */ public function up() { - Schema::table( 'nexopos_orders_products_refunds', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products_refunds', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products_refunds', 'tax_value' ) ) { $table->float( 'tax_value' )->default(0); } }); - Schema::table( 'nexopos_orders_refunds', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_refunds', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_refunds', 'tax_value' ) ) { $table->float( 'tax_value' )->default(0); } diff --git a/database/migrations/update/2021_09_01_194454_update_unit_product_quantities_table_sept1_21.php b/database/migrations/update/2021_09_01_194454_update_unit_product_quantities_table_sept1_21.php index e6f62aa74..8487c9dfa 100644 --- a/database/migrations/update/2021_09_01_194454_update_unit_product_quantities_table_sept1_21.php +++ b/database/migrations/update/2021_09_01_194454_update_unit_product_quantities_table_sept1_21.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products_unit_quantities', 'custom_price' ) ) { $table->float( 'custom_price' )->default(0); } diff --git a/database/migrations/update/2021_09_30_091808_update_columns_length_sept30_21.php b/database/migrations/update/2021_09_30_091808_update_columns_length_sept30_21.php index 874c2daf3..a6c4d3bdd 100644 --- a/database/migrations/update/2021_09_30_091808_update_columns_length_sept30_21.php +++ b/database/migrations/update/2021_09_30_091808_update_columns_length_sept30_21.php @@ -13,34 +13,34 @@ */ public function up() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements', 'value' ) ) { $table->float( 'value', 18, 5 )->change(); } }); - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { $table->float( 'purchases_amount', 18, 5 )->change(); $table->float( 'owed_amount', 18, 5 )->change(); $table->float( 'account_amount', 18, 5 )->change(); }); - Schema::table( 'nexopos_expenses', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses', function ( Blueprint $table ) { $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_orders_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_coupons', function ( Blueprint $table ) { $table->float( 'discount_value', 18, 5 )->change(); $table->float( 'minimum_cart_value', 18, 5 )->change(); $table->float( 'maximum_cart_value', 18, 5 )->change(); $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_orders_payments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_payments', function ( Blueprint $table ) { $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { $table->float( 'before_quantity', 18, 5 )->change(); $table->float( 'quantity', 18, 5 )->change(); $table->float( 'after_quantity', 18, 5 )->change(); @@ -48,63 +48,63 @@ public function up() $table->float( 'total_price', 18, 5 )->change(); }); - Schema::table( 'nexopos_products', function( Blueprint $table ) { + Schema::table( 'nexopos_products', function ( Blueprint $table ) { $table->float( 'tax_value', 18, 5 )->change(); // computed automatically }); - Schema::table( 'nexopos_products_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_products_taxes', function ( Blueprint $table ) { $table->float( 'rate', 18, 5 )->change(); $table->float( 'value', 18, 5 )->change(); // actual computed tax value }); - Schema::table( 'nexopos_providers', function( Blueprint $table ) { + Schema::table( 'nexopos_providers', function ( Blueprint $table ) { $table->float( 'amount_due', 18, 5 )->change(); $table->float( 'amount_paid', 18, 5 )->change(); }); - Schema::table( 'nexopos_units', function( Blueprint $table ) { + Schema::table( 'nexopos_units', function ( Blueprint $table ) { $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_taxes', function( Blueprint $table ) { + Schema::table( 'nexopos_taxes', function ( Blueprint $table ) { $table->float( 'rate', 18, 5 )->change(); }); - Schema::table( 'nexopos_rewards_system', function( Blueprint $table ) { + Schema::table( 'nexopos_rewards_system', function ( Blueprint $table ) { $table->float( 'target', 18, 5 )->change(); }); - Schema::table( 'nexopos_rewards_system_rules', function( Blueprint $table ) { + Schema::table( 'nexopos_rewards_system_rules', function ( Blueprint $table ) { $table->float( 'from', 18, 5 )->change(); $table->float( 'to', 18, 5 )->change(); $table->float( 'reward', 18, 5 )->change(); }); - Schema::table( 'nexopos_orders_instalments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_instalments', function ( Blueprint $table ) { $table->float( 'amount', 18, 5 )->change(); }); - Schema::table( 'nexopos_registers', function( Blueprint $table ) { + Schema::table( 'nexopos_registers', function ( Blueprint $table ) { $table->float( 'balance', 18, 5 )->change(); }); - Schema::table( 'nexopos_customers_rewards', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_rewards', function ( Blueprint $table ) { $table->float( 'points', 18, 5 )->change(); $table->float( 'target', 18, 5 )->change(); }); - Schema::table( 'nexopos_coupons', function( Blueprint $table ) { + Schema::table( 'nexopos_coupons', function ( Blueprint $table ) { $table->float( 'discount_value', 18, 5 )->change(); $table->float( 'minimum_cart_value', 18, 5 )->change(); $table->float( 'maximum_cart_value', 18, 5 )->change(); $table->float( 'limit_usage', 18, 5 )->change(); }); - Schema::table( 'nexopos_dashboard_months', function( Blueprint $table ) { + Schema::table( 'nexopos_dashboard_months', function ( Blueprint $table ) { $table->float( 'month_taxes', 18, 5 )->change(); $table->float( 'month_unpaid_orders', 18, 5 )->change(); $table->float( 'month_unpaid_orders_count', 18, 5 )->change(); @@ -131,24 +131,24 @@ public function up() $table->float( 'total_expenses', 18, 5 )->change(); }); - Schema::table( 'nexopos_cash_flow', function( Blueprint $table ) { + Schema::table( 'nexopos_cash_flow', function ( Blueprint $table ) { $table->float( 'value', 18, 5 )->change(); }); - Schema::table( 'nexopos_orders_refunds', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_refunds', function ( Blueprint $table ) { $table->float( 'total', 18, 5 )->change(); $table->float( 'tax_value', 18, 5 )->change(); $table->float( 'shipping', 18, 5 )->change(); }); - Schema::table( 'nexopos_orders_products_refunds', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products_refunds', function ( Blueprint $table ) { $table->float( 'unit_price', 18, 5 )->change(); $table->float( 'tax_value', 18, 5 )->change(); $table->float( 'quantity', 18, 5 )->change(); $table->float( 'total_price', 18, 5 )->change(); }); - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products_units_quantities', 'quantity' ) ) { $table->float( 'quantity', 18, 5 )->change(); } @@ -196,7 +196,7 @@ public function up() } }); - Schema::table( 'nexopos_procurements_products', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements_products', 'gross_purchase_price' ) ) { $table->float( 'gross_purchase_price', 18, 5 )->change(); } @@ -220,7 +220,7 @@ public function up() } }); - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'discount' ) ) { $table->float( 'discount', 18, 5 )->change(); } @@ -259,7 +259,7 @@ public function up() } }); - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'quantity' ) ) { $table->float( 'quantity', 18, 5 )->change(); // could be the base unit } diff --git a/database/migrations/update/2021_11_05_102755_update_products_unit_quantities_nov0521.php b/database/migrations/update/2021_11_05_102755_update_products_unit_quantities_nov0521.php index e4fa14656..4f629d7c6 100644 --- a/database/migrations/update/2021_11_05_102755_update_products_unit_quantities_nov0521.php +++ b/database/migrations/update/2021_11_05_102755_update_products_unit_quantities_nov0521.php @@ -15,7 +15,7 @@ */ public function up() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products_unit_quantities', 'low_quantity' ) ) { $table->float( 'low_quantity', 18, 5 )->default(0); } @@ -47,7 +47,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products_unit_quantities', 'low_quantity' ) ) { $table->dropColumn( 'low_quantity' ); } diff --git a/database/migrations/update/2021_11_21_205222_update_customer_table_add_birth_date_column_nov2121.php b/database/migrations/update/2021_11_21_205222_update_customer_table_add_birth_date_column_nov2121.php index 4a51859d0..7365f99b4 100644 --- a/database/migrations/update/2021_11_21_205222_update_customer_table_add_birth_date_column_nov2121.php +++ b/database/migrations/update/2021_11_21_205222_update_customer_table_add_birth_date_column_nov2121.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_customers' ) ) { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_customers', 'birth_date' ) ) { $table->datetime( 'birth_date' )->nullable(); } @@ -30,7 +30,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_customers' ) ) { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers', 'birth_date' ) ) { $table->dropColumn( 'birth_date' ); } diff --git a/database/migrations/update/2021_11_25_032153_update_procurement_table_nov2521.php b/database/migrations/update/2021_11_25_032153_update_procurement_table_nov2521.php index fd780376f..3777c2d93 100644 --- a/database/migrations/update/2021_11_25_032153_update_procurement_table_nov2521.php +++ b/database/migrations/update/2021_11_25_032153_update_procurement_table_nov2521.php @@ -13,13 +13,13 @@ */ public function up() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements', 'value' ) && ! Schema::hasColumn( 'nexopos_procurements', 'cost' ) ) { $table->renameColumn( 'value', 'cost' ); } }); - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_procurements', 'value' ) ) { $table->float( 'value', 18, 5 )->default(0); } @@ -33,7 +33,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_procurements', 'value' ) && Schema::hasColumn( 'nexopos_procurements', 'cost' ) ) { $table->renameColumn( 'cost', 'value' ); } diff --git a/database/migrations/update/2021_12_23_061301_set_cashier_permissions.php b/database/migrations/update/2021_12_23_061301_set_cashier_permissions.php index 7ac0a6847..15538ff49 100644 --- a/database/migrations/update/2021_12_23_061301_set_cashier_permissions.php +++ b/database/migrations/update/2021_12_23_061301_set_cashier_permissions.php @@ -27,7 +27,7 @@ public function up() Permission::where( 'namespace', 'like', '%nexopos.pos%' ) ->get() - ->each( function( $permission ) use ( $role ) { + ->each( function ( $permission ) use ( $role ) { $role->addPermissions( $permission->namespace ); }); diff --git a/database/migrations/update/2021_12_28_090346_updatee_instalment_table_dec2821.php b/database/migrations/update/2021_12_28_090346_updatee_instalment_table_dec2821.php index 58f6a332d..6428ba7a0 100644 --- a/database/migrations/update/2021_12_28_090346_updatee_instalment_table_dec2821.php +++ b/database/migrations/update/2021_12_28_090346_updatee_instalment_table_dec2821.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_instalments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_instalments', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_instalments', 'payment_id' ) ) { $table->integer( 'payment_id' )->nullable(); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_instalments', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_instalments', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_instalments', 'payment_id' ) ) { $table->dropColumn( 'payment_id' ); } diff --git a/database/migrations/update/2022_01_11_100733_update_customer_table_jan1122.php b/database/migrations/update/2022_01_11_100733_update_customer_table_jan1122.php index 24bed2c89..b7abce5e9 100644 --- a/database/migrations/update/2022_01_11_100733_update_customer_table_jan1122.php +++ b/database/migrations/update/2022_01_11_100733_update_customer_table_jan1122.php @@ -15,7 +15,7 @@ */ public function up() { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { $keyExists = DB::select( DB::raw( 'SHOW KEYS @@ -41,7 +41,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_customers', function( Blueprint $table ) { + Schema::table( 'nexopos_customers', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers', 'credit_limit_amount' ) ) { $table->dropColumn( 'credit_limit_amount' ); } diff --git a/database/migrations/update/2022_01_22_073632_update_users_attribute_jan2222.php b/database/migrations/update/2022_01_22_073632_update_users_attribute_jan2222.php index 754648d50..8a307725b 100644 --- a/database/migrations/update/2022_01_22_073632_update_users_attribute_jan2222.php +++ b/database/migrations/update/2022_01_22_073632_update_users_attribute_jan2222.php @@ -23,7 +23,7 @@ public function runOnMultiStore() */ public function up() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_users_attributes', 'theme' ) ) { $table->string( 'theme' )->default( 'light' ); } @@ -37,7 +37,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_users_attributes', function( Blueprint $table ) { + Schema::table( 'nexopos_users_attributes', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_users_attributes', 'theme' ) ) { $table->dropColumn( 'theme' ); } diff --git a/database/migrations/update/2022_01_25_230855_update_nexo_p_o_s_orders_payments220126.php b/database/migrations/update/2022_01_25_230855_update_nexo_p_o_s_orders_payments220126.php index 68c21bc0a..40b8cd6db 100644 --- a/database/migrations/update/2022_01_25_230855_update_nexo_p_o_s_orders_payments220126.php +++ b/database/migrations/update/2022_01_25_230855_update_nexo_p_o_s_orders_payments220126.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_payments_types', function( Blueprint $table ) { + Schema::table( 'nexopos_payments_types', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_payments_types', 'priority' ) ) { $table->integer( 'priority' )->default(0); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_payments_types', function( Blueprint $table ) { + Schema::table( 'nexopos_payments_types', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_payments_types', 'priority' ) ) { $table->dropColumn( 'priority' ); } diff --git a/database/migrations/update/2022_03_01_091451_update_cash_register_history_march1_2022.php b/database/migrations/update/2022_03_01_091451_update_cash_register_history_march1_2022.php index ba499bc30..64f51abcb 100644 --- a/database/migrations/update/2022_03_01_091451_update_cash_register_history_march1_2022.php +++ b/database/migrations/update/2022_03_01_091451_update_cash_register_history_march1_2022.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_registers_history' ) ) { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_registers_history', 'transaction_type' ) ) { $table->string( 'transaction_type' )->nullable(); // can be "negative", "positive". } @@ -34,7 +34,7 @@ public function up() public function down() { if ( Schema::hasTable( 'nexopos_registers_history' ) ) { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_registers_history', 'transaction_type' ) ) { $table->dropColumn( 'transaction_type' ); } diff --git a/database/migrations/update/2022_03_24_081332_update_procurements_table_240322.php b/database/migrations/update/2022_03_24_081332_update_procurements_table_240322.php index 8a11f258e..fa4ee7057 100644 --- a/database/migrations/update/2022_03_24_081332_update_procurements_table_240322.php +++ b/database/migrations/update/2022_03_24_081332_update_procurements_table_240322.php @@ -14,13 +14,13 @@ */ public function up() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_procurements', 'invoice_date' ) ) { $table->datetime( 'invoice_date' )->nullable(); } }); - Procurement::get()->each( function( $procurement ) { + Procurement::get()->each( function ( $procurement ) { $procurement->invoice_date = $procurement->created_at; $procurement->save(); }); @@ -33,7 +33,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_procurements', function( Blueprint $table ) { + Schema::table( 'nexopos_procurements', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_procurements', 'invoice_date' ) ) { $table->dropColumn( 'invoice_date' ); } diff --git a/database/migrations/update/2022_03_24_121511_update_cash_register_history_march2422.php b/database/migrations/update/2022_03_24_121511_update_cash_register_history_march2422.php index 44d7932ac..437fb203f 100644 --- a/database/migrations/update/2022_03_24_121511_update_cash_register_history_march2422.php +++ b/database/migrations/update/2022_03_24_121511_update_cash_register_history_march2422.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_registers_history', 'balance_before' ) ) { $table->float( 'balance_before' )->default(0); } @@ -27,7 +27,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_registers_history', 'balance_before' ) ) { $table->dropColumn( 'balance_before' ); } diff --git a/database/migrations/update/2022_05_05_113653_update_customer_table05_may22.php b/database/migrations/update/2022_05_05_113653_update_customer_table05_may22.php index 8b4aea000..e1a289c6d 100644 --- a/database/migrations/update/2022_05_05_113653_update_customer_table05_may22.php +++ b/database/migrations/update/2022_05_05_113653_update_customer_table05_may22.php @@ -15,7 +15,7 @@ */ public function up() { - Schema::table( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_account_history', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_customers_account_history', 'previous_amount' ) ) { $table->float( 'previous_amount' )->default(0); } @@ -25,11 +25,11 @@ public function up() } }); - Customer::get()->each( function( $customer ) { + Customer::get()->each( function ( $customer ) { $customer->account_history() ->orderBy( 'created_at', 'desc' ) ->get() - ->each( function( $walletHistory ) { + ->each( function ( $walletHistory ) { $this->handleWalletHistory( $walletHistory ); }); }); @@ -67,7 +67,7 @@ protected function handleWalletHistory( $history ) */ public function down() { - Schema::table( 'nexopos_customers_account_history', function( Blueprint $table ) { + Schema::table( 'nexopos_customers_account_history', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_customers_account_history', 'previous_amount' ) ) { $table->dropColumn( 'previous_amount' ); } diff --git a/database/migrations/update/2022_06_04_132409_update_order_product_table_jun22.php b/database/migrations/update/2022_06_04_132409_update_order_product_table_jun22.php index f53ef1fb3..300808ea0 100644 --- a/database/migrations/update/2022_06_04_132409_update_order_product_table_jun22.php +++ b/database/migrations/update/2022_06_04_132409_update_order_product_table_jun22.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders_products', 'product_type' ) ) { $table->string( 'product_type' )->default( 'product' ); } @@ -31,7 +31,7 @@ public function up() */ public function down() { - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'product_type' ) ) { $table->dropColumn( 'product_type' ); } diff --git a/database/migrations/update/2022_06_21_161850_update_unit_quantities_attributes.php b/database/migrations/update/2022_06_21_161850_update_unit_quantities_attributes.php index 9db64b4a4..57365e783 100644 --- a/database/migrations/update/2022_06_21_161850_update_unit_quantities_attributes.php +++ b/database/migrations/update/2022_06_21_161850_update_unit_quantities_attributes.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products_unit_quantities', 'net_sale_price' ) ) { $table->float( 'net_sale_price' )->default(0)->after( 'sale_price' ); } diff --git a/database/migrations/update/2022_07_19_233355_update_register_history_table_jul2022.php b/database/migrations/update/2022_07_19_233355_update_register_history_table_jul2022.php index c5f99a1b6..c80e76ded 100644 --- a/database/migrations/update/2022_07_19_233355_update_register_history_table_jul2022.php +++ b/database/migrations/update/2022_07_19_233355_update_register_history_table_jul2022.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_registers_history', 'balance_before' ) ) { $table->float( 'balance_before', 18, 5 )->change(); } @@ -22,13 +22,13 @@ public function up() } }); - Schema::table( 'nexopos_users', function( Blueprint $table ) { + Schema::table( 'nexopos_users', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_users', 'total_sales' ) ) { $table->float( 'total_sales', 18, 5 )->change(); } }); - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_orders', 'support_instalments' ) ) { $table->boolean( 'support_instalments' )->default(true); } diff --git a/database/migrations/update/2022_08_16_134852_update_notification_table.php b/database/migrations/update/2022_08_16_134852_update_notification_table.php index ebb7f5dbf..053a2707e 100644 --- a/database/migrations/update/2022_08_16_134852_update_notification_table.php +++ b/database/migrations/update/2022_08_16_134852_update_notification_table.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_notifications' ) ) { - Schema::table( 'nexopos_notifications', function( Blueprint $table ) { + Schema::table( 'nexopos_notifications', function ( Blueprint $table ) { $table->text( 'description' )->change(); }); } diff --git a/database/migrations/update/2022_09_23_052626_update_product_columns23_sept222.php b/database/migrations/update/2022_09_23_052626_update_product_columns23_sept222.php index 69f426afe..1a584e31b 100644 --- a/database/migrations/update/2022_09_23_052626_update_product_columns23_sept222.php +++ b/database/migrations/update/2022_09_23_052626_update_product_columns23_sept222.php @@ -13,7 +13,7 @@ */ public function up() { - Schema::table( 'nexopos_products_unit_quantities', function( Blueprint $table ) { + Schema::table( 'nexopos_products_unit_quantities', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_products_unit_quantities', 'net_sale_price' ) && ! Schema::hasColumn( 'nexopos_products_unit_quantities', 'sale_price_with_tax' ) ) { $table->renameColumn( 'net_sale_price', 'sale_price_with_tax' ); } @@ -43,7 +43,7 @@ public function up() } }); - Schema::table( 'nexopos_orders_products', function( Blueprint $table ) { + Schema::table( 'nexopos_orders_products', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders_products', 'gross_price' ) && ! Schema::hasColumn( 'nexopos_orders_products', 'price_without_tax' ) ) { $table->renameColumn( 'gross_price', 'price_without_tax' ); } @@ -61,7 +61,7 @@ public function up() } }); - Schema::table( 'nexopos_orders', function( Blueprint $table ) { + Schema::table( 'nexopos_orders', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_orders', 'net_total' ) ) { $table->renameColumn( 'net_total', 'total_with_tax' ); } diff --git a/database/migrations/update/2022_10_12_083552_update_register_history_oct12_22.php b/database/migrations/update/2022_10_12_083552_update_register_history_oct12_22.php index cb90a9dc8..781b964af 100644 --- a/database/migrations/update/2022_10_12_083552_update_register_history_oct12_22.php +++ b/database/migrations/update/2022_10_12_083552_update_register_history_oct12_22.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_registers_history' ) ) { - Schema::table( 'nexopos_registers_history', function( Blueprint $table ) { + Schema::table( 'nexopos_registers_history', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_registers_history', 'payment_id' ) ) { $table->integer( 'payment_id' )->nullable(); } diff --git a/database/migrations/update/2023_02_14_123130_update_product_history_table14_fev23.php b/database/migrations/update/2023_02_14_123130_update_product_history_table14_fev23.php index f82923045..42bf0a8a6 100644 --- a/database/migrations/update/2023_02_14_123130_update_product_history_table14_fev23.php +++ b/database/migrations/update/2023_02_14_123130_update_product_history_table14_fev23.php @@ -14,7 +14,7 @@ */ public function up() { - Schema::table( 'nexopos_products_histories', function( Blueprint $table ) { + Schema::table( 'nexopos_products_histories', function ( Blueprint $table ) { if ( ! Schema::hasColumn( 'nexopos_products_histories', 'order_product_id' ) ) { $table->integer( 'order_product_id' )->nullable(); } diff --git a/database/migrations/update/2023_03_16_214039_update_expense_table.php b/database/migrations/update/2023_03_16_214039_update_expense_table.php index 97ad9529c..bfe380fad 100644 --- a/database/migrations/update/2023_03_16_214039_update_expense_table.php +++ b/database/migrations/update/2023_03_16_214039_update_expense_table.php @@ -14,7 +14,7 @@ public function up() { if ( Schema::hasTable( 'nexopos_expenses' ) ) { - Schema::table( 'nexopos_expenses', function( Blueprint $table ) { + Schema::table( 'nexopos_expenses', function ( Blueprint $table ) { if ( Schema::hasColumn( 'nexopos_expenses', 'occurence' ) ) { $table->renameColumn( 'occurence', 'occurrence' ); } diff --git a/database/migrations/update/2023_07_30_235454_fix_wrong_purchase_price_32_jul_23.php b/database/migrations/update/2023_07_30_235454_fix_wrong_purchase_price_32_jul_23.php index 522d7aacb..85226ccb0 100644 --- a/database/migrations/update/2023_07_30_235454_fix_wrong_purchase_price_32_jul_23.php +++ b/database/migrations/update/2023_07_30_235454_fix_wrong_purchase_price_32_jul_23.php @@ -5,9 +5,7 @@ use App\Models\Product; use App\Services\ProductService; use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\Schema; return new class extends Migration { @@ -20,21 +18,21 @@ */ public function up() { - $this->productService = app()->make( ProductService::class ); + $this->productService = app()->make( ProductService::class ); /** * will ensure a single product * is handled every time. */ - $cached = json_decode( Cache::get( 'fix_wrong_purchase_prices', '[]' ) ); + $cached = json_decode( Cache::get( 'fix_wrong_purchase_prices', '[]' ) ); - OrderProduct::whereNotIn( 'id', $cached )->get()->each( function( OrderProduct $orderProduct ) use ( $cached ) { - $product = Product::find( $orderProduct->product_id ); - $lastPurchasePrice = $this->productService->getLastPurchasePrice( $product, $orderProduct->created_at ); - $orderProduct->total_purchase_price = Currency::fresh( $lastPurchasePrice )->multipliedBy( $orderProduct->quantity )->getRaw(); + OrderProduct::whereNotIn( 'id', $cached )->get()->each( function ( OrderProduct $orderProduct ) use ( $cached ) { + $product = Product::find( $orderProduct->product_id ); + $lastPurchasePrice = $this->productService->getLastPurchasePrice( $product, $orderProduct->created_at ); + $orderProduct->total_purchase_price = Currency::fresh( $lastPurchasePrice )->multipliedBy( $orderProduct->quantity )->getRaw(); $orderProduct->save(); - $cached[] = $orderProduct->id; + $cached[] = $orderProduct->id; Cache::put( 'fix_wrong_purchase_prices', json_encode( $cached ), now()->addDay() ); }); diff --git a/database/seeders/ProductsSeeder.php b/database/seeders/ProductsSeeder.php index 056122c80..ee41f3515 100644 --- a/database/seeders/ProductsSeeder.php +++ b/database/seeders/ProductsSeeder.php @@ -20,12 +20,12 @@ public function run() return ProductCategory::factory() ->count(2) ->create() - ->each( function( $category ) { + ->each( function ( $category ) { Product::factory() ->count(3) ->create([ 'category_id' => $category->id ]) - ->each( function( $product ) { - UnitGroup::find( $product->unit_group )->units->each( function( $unit ) use ( $product ) { + ->each( function ( $product ) { + UnitGroup::find( $product->unit_group )->units->each( function ( $unit ) use ( $product ) { ProductUnitQuantity::factory() ->count(1) ->create([ diff --git a/routes/api-base.php b/routes/api-base.php index eb5c185f9..0021432d6 100644 --- a/routes/api-base.php +++ b/routes/api-base.php @@ -5,17 +5,17 @@ use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Support\Facades\Route; -Route::prefix( 'nexopos/v4' )->group( function() { +Route::prefix( 'nexopos/v4' )->group( function () { Route::middleware([ InstalledStateMiddleware::class, SubstituteBindings::class, ClearRequestCacheMiddleware::class, - ])->group( function() { + ])->group( function () { include dirname( __FILE__ ) . '/api/fields.php'; Route::middleware([ 'auth:sanctum', - ])->group( function() { + ])->group( function () { include dirname( __FILE__ ) . '/api/dashboard.php'; include dirname( __FILE__ ) . '/api/categories.php'; include dirname( __FILE__ ) . '/api/customers.php'; @@ -43,7 +43,7 @@ include dirname( __FILE__ ) . '/api/hard-reset.php'; include_once dirname( __FILE__ ) . '/api/update.php'; - Route::prefix( 'setup' )->group( function() { + Route::prefix( 'setup' )->group( function () { Route::post( 'database', 'SetupController@checkDatabase' ); Route::get( 'database', 'SetupController@checkDbConfigDefined' ); Route::post( 'configuration', 'SetupController@saveConfiguration' ); diff --git a/routes/api.php b/routes/api.php index b1b9a7458..263f64ece 100644 --- a/routes/api.php +++ b/routes/api.php @@ -39,7 +39,7 @@ */ $domainString = ( $domain[ 'filename' ] ?: 'localhost' ) . ( isset( $domain[ 'extension' ] ) ? '.' . $domain[ 'extension' ] : '' ); - Route::domain( $domainString )->group( function() { + Route::domain( $domainString )->group( function () { include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'api-base.php'; }); } else { diff --git a/routes/authenticate.php b/routes/authenticate.php index 44d03bf1a..4237c48b1 100644 --- a/routes/authenticate.php +++ b/routes/authenticate.php @@ -18,7 +18,7 @@ */ Route::middleware([ RegistrationMiddleware::class, -])->group( function() { +])->group( function () { Route::post( '/auth/sign-up', [ AuthController::class, 'postSignUp' ])->name( ns()->routeName( 'ns.register.post' ) ); }); @@ -28,7 +28,7 @@ */ Route::middleware([ PasswordRecoveryMiddleware::class, -])->group( function() { +])->group( function () { Route::get( '/password-lost', [ AuthController::class, 'passwordLost' ])->name( ns()->routeName( 'ns.password-lost' ) ); Route::post( '/auth/password-lost', [ AuthController::class, 'postPasswordLost' ])->name( ns()->routeName( 'ns.password-lost.post' ) ); Route::post( '/auth/new-password/{user}/{token}', [ AuthController::class, 'postNewPassword' ])->name( ns()->routeName( 'ns.post.new-password' ) ); diff --git a/routes/debug.php b/routes/debug.php index e5b383dd2..1a3142ca4 100644 --- a/routes/debug.php +++ b/routes/debug.php @@ -5,8 +5,8 @@ use Illuminate\Support\Facades\Route; if ( env( 'APP_DEBUG' ) ) { - Route::get( '/routes', function() { - $values = collect( array_values( (array) app( 'router' )->getRoutes() )[1] )->map( function( RoutingRoute $route ) { + Route::get( '/routes', function () { + $values = collect( array_values( (array) app( 'router' )->getRoutes() )[1] )->map( function ( RoutingRoute $route ) { return [ 'domain' => $route->getDomain(), 'uri' => $route->uri(), @@ -18,7 +18,7 @@ return ( new ArrayToTextTable( $values->toArray() ) )->render(); }); - Route::get( '/exceptions/{class}', function( $class ) { + Route::get( '/exceptions/{class}', function ( $class ) { $exceptions = [ \App\Exceptions\CoreException::class, \App\Exceptions\CoreVersionMismatchException::class, diff --git a/routes/intermediate.php b/routes/intermediate.php index ba192dbad..1df59c5b8 100644 --- a/routes/intermediate.php +++ b/routes/intermediate.php @@ -4,7 +4,7 @@ */ use Illuminate\Support\Facades\Route; -Route::get( '/intermediate/{route}/{from}', function( $route, $from ) { +Route::get( '/intermediate/{route}/{from}', function ( $route, $from ) { $message = null; switch ( $from ) { diff --git a/routes/web-base.php b/routes/web-base.php index babc5fcfe..88de7b2a8 100644 --- a/routes/web-base.php +++ b/routes/web-base.php @@ -16,7 +16,7 @@ use Illuminate\Routing\Middleware\SubstituteBindings; use Illuminate\Support\Facades\Route; -Route::middleware([ 'web' ])->group( function() { +Route::middleware([ 'web' ])->group( function () { Route::get('/', [ HomeController::class, 'welcome' ])->name( 'ns.welcome' ); }); @@ -26,7 +26,7 @@ InstalledStateMiddleware::class, CheckMigrationStatus::class, SubstituteBindings::class, -])->group( function() { +])->group( function () { /** * We would like to isolate certain routes as it's registered * for authentication and are likely to be applicable to sub stores @@ -42,13 +42,13 @@ CheckApplicationHealthMiddleware::class, ClearRequestCacheMiddleware::class, FooterOutputHookMiddleware::class, - ])->group( function() { - Route::prefix( 'dashboard' )->group( function() { + ])->group( function () { + Route::prefix( 'dashboard' )->group( function () { event( new WebRoutesLoadedEvent( 'dashboard' ) ); Route::middleware([ HandleCommonRoutesMiddleware::class, - ])->group( function() { + ])->group( function () { require dirname( __FILE__ ) . '/nexopos.php'; }); @@ -63,8 +63,8 @@ Route::middleware([ NotInstalledStateMiddleware::class, ClearRequestCacheMiddleware::class, -])->group( function() { - Route::prefix( '/do-setup/' )->group( function() { +])->group( function () { + Route::prefix( '/do-setup/' )->group( function () { Route::get( '', [ SetupController::class, 'welcome' ])->name( 'ns.do-setup' ); }); }); diff --git a/routes/web.php b/routes/web.php index 4d18f6b09..f2ab6f8d2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,7 +35,7 @@ */ $domainString = ( $domain[ 'filename' ] ?: 'localhost' ) . ( isset( $domain[ 'extension' ] ) ? '.' . $domain[ 'extension' ] : '' ); - Route::domain( $domainString )->group( function() { + Route::domain( $domainString )->group( function () { include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'web-base.php'; }); } else { diff --git a/tests/Feature/CreateOrderPaidWithCustomerCredit.php b/tests/Feature/CreateOrderPaidWithCustomerCredit.php index eb9e68eab..db6d7e3be 100644 --- a/tests/Feature/CreateOrderPaidWithCustomerCredit.php +++ b/tests/Feature/CreateOrderPaidWithCustomerCredit.php @@ -42,7 +42,7 @@ public function test_make_order_on_credit() $customer->save(); $products = Product::with( 'unit_quantities' )->get()->shuffle()->take(3); - $products = $products->map( function( $product ) use ( $faker ) { + $products = $products->map( function ( $product ) use ( $faker ) { $unitElement = $faker->randomElement( $product->unit_quantities ); $data = array_merge([ @@ -60,12 +60,12 @@ public function test_make_order_on_credit() } return $data; - })->filter( function( $product ) { + })->filter( function ( $product ) { return $product[ 'quantity' ] > 0; }); $shippingFees = $faker->randomElement([10, 15, 20, 25, 30, 35, 40]); - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) use ($currency) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) use ($currency) { return $currency ->define( $product[ 'unit_price' ] ) ->multiplyBy( $product[ 'quantity' ] ) @@ -85,7 +85,7 @@ public function test_make_order_on_credit() */ $this->defaultProcessing = true; - $response = $this->attemptPostOrder( function( $response, $data ) { + $response = $this->attemptPostOrder( function ( $response, $data ) { $order = Order::find( $data[ 'data' ][ 'order' ][ 'id' ] ); }); @@ -108,7 +108,7 @@ public function processOrders( $currentDate, $callback ) $shippingFees = $faker->randomElement([10, 15, 20, 25, 30, 35, 40]); $discountRate = $faker->numberBetween(0, 5); - $products = $products->map( function( $product ) use ( $faker ) { + $products = $products->map( function ( $product ) use ( $faker ) { $unitElement = $faker->randomElement( $product->unit_quantities ); $data = array_merge([ @@ -126,11 +126,11 @@ public function processOrders( $currentDate, $callback ) } return $data; - })->filter( function( $product ) { + })->filter( function ( $product ) { return $product[ 'quantity' ] > 0; }); - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) use ($currency) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) use ($currency) { return $currency ->define( $product[ 'unit_price' ] ) ->multiplyBy( $product[ 'quantity' ] ) diff --git a/tests/Feature/CreateUserTest.php b/tests/Feature/CreateUserTest.php index 30c2a27d4..c1054089e 100644 --- a/tests/Feature/CreateUserTest.php +++ b/tests/Feature/CreateUserTest.php @@ -43,7 +43,7 @@ public function test_create_users() $this->users = app()->make( Users::class ); - return Role::get()->map( function( $role ) { + return Role::get()->map( function ( $role ) { $password = Hash::make( Str::random(20) ); $configuration = [ @@ -122,8 +122,8 @@ public function test_create_users() */ public function test_delete_users() { - Role::get()->map( function( Role $role ) { - $role->users()->get()->each( function( User $user ) { + Role::get()->map( function ( Role $role ) { + $role->users()->get()->each( function ( User $user ) { $this->attemptAuthenticate( $user ); /** @@ -171,7 +171,7 @@ private function attemptAllRoutes( $user ) '/\{group\}/' => UnitGroup::class, '/\{unit\}/' => Unit::class, '/\{reward\}/' => RewardSystem::class, - '/\{customer\}|\{customerAccountHistory\}/' => function() { + '/\{customer\}|\{customerAccountHistory\}/' => function () { $customerAccountHistory = CustomerAccountHistory::first()->id; $customer = $customerAccountHistory->customer->id; diff --git a/tests/Feature/CrudEditEntitiesTest.php b/tests/Feature/CrudEditEntitiesTest.php index 82c91d38f..c3d96985c 100644 --- a/tests/Feature/CrudEditEntitiesTest.php +++ b/tests/Feature/CrudEditEntitiesTest.php @@ -20,13 +20,13 @@ public function test_edit_crud_form() $this->attemptAuthenticate(); collect( Storage::disk( 'ns' )->files( 'app/Crud' ) ) - ->map( function( $fileName ) { + ->map( function ( $fileName ) { $fileName = collect( explode( '/', $fileName ) ); $file = pathinfo( $fileName->last() ); return 'App\\Crud\\' . $file[ 'filename' ]; }) - ->each( function( $class ) { + ->each( function ( $class ) { $object = new $class; if ( ! empty( $object->getNamespace() ) ) { diff --git a/tests/Feature/ExceptionsTest.php b/tests/Feature/ExceptionsTest.php index 61a48736e..a4d9cc16b 100644 --- a/tests/Feature/ExceptionsTest.php +++ b/tests/Feature/ExceptionsTest.php @@ -23,7 +23,7 @@ public function testExceptionsOutput() \App\Exceptions\NotFoundException::class, \App\Exceptions\QueryException::class, \App\Exceptions\ValidationException::class, - ])->each( function( $class ) { + ])->each( function ( $class ) { $instance = new $class; $response = $this->get( 'exceptions/' . $class ); $response->assertSee( $instance->getMessage() ); diff --git a/tests/Feature/ResetUserStatsTest.php b/tests/Feature/ResetUserStatsTest.php index 5847abf9e..26bbed444 100644 --- a/tests/Feature/ResetUserStatsTest.php +++ b/tests/Feature/ResetUserStatsTest.php @@ -14,7 +14,7 @@ class ResetUserStatsTest extends TestCase */ public function testResetUserStats() { - User::get()->each( function( $user ) { + User::get()->each( function ( $user ) { $user->total_sales_count = 0; $user->total_sales = 0; $user->save(); diff --git a/tests/Feature/SaveSettingsTest.php b/tests/Feature/SaveSettingsTest.php index 0ef61d524..177be76dd 100644 --- a/tests/Feature/SaveSettingsTest.php +++ b/tests/Feature/SaveSettingsTest.php @@ -25,19 +25,19 @@ public function testSaveSettings() ); collect( Storage::disk( 'ns' )->files( 'app/Settings' ) ) - ->map( function( $fileName ) { + ->map( function ( $fileName ) { $fileName = collect( explode( '/', $fileName ) ); $file = pathinfo( $fileName->last() ); return 'App\\Settings\\' . $file[ 'filename' ]; }) - ->each( function( $class ) { + ->each( function ( $class ) { $object = new $class; - $form = collect( $object->getForm()[ 'tabs' ] )->mapWithKeys( function( $value, $key ) { + $form = collect( $object->getForm()[ 'tabs' ] )->mapWithKeys( function ( $value, $key ) { return [ $key => collect( $value[ 'fields' ] ) - ->mapWithKeys( function( $field ) { + ->mapWithKeys( function ( $field ) { return [ $field[ 'name' ] => match ( $field[ 'name' ] ) { 'ns_store_language' => 'en', diff --git a/tests/Feature/TestNsRacksManagerTransferToInventory.php b/tests/Feature/TestNsRacksManagerTransferToInventory.php index ba08c8d68..f9b8ed719 100644 --- a/tests/Feature/TestNsRacksManagerTransferToInventory.php +++ b/tests/Feature/TestNsRacksManagerTransferToInventory.php @@ -94,15 +94,15 @@ public function testExample() 'products' => Product::whereIn( 'id', [ $rackProduct->product_id ]) ->with( 'unitGroup' ) ->get() - ->map( function( $product ) { - return $product->unitGroup->units->map( function( $unit ) use ( $product ) { + ->map( function ( $product ) { + return $product->unitGroup->units->map( function ( $unit ) use ( $product ) { return (object) [ 'unit' => $unit, 'unitQuantity' => $product->unit_quantities->filter( fn( $q ) => $q->unit_id === $unit->id )->first(), 'product' => $product, ]; }); - })->flatten()->map( function( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker, $rack ) { + })->flatten()->map( function ( $data ) use ( $taxService, $taxType, $taxGroup, $margin, $faker, $rack ) { return [ 'product_id' => $data->product->id, 'gross_purchase_price' => 15, diff --git a/tests/Traits/WithCombinedProductTest.php b/tests/Traits/WithCombinedProductTest.php index ba8204469..6ee243012 100644 --- a/tests/Traits/WithCombinedProductTest.php +++ b/tests/Traits/WithCombinedProductTest.php @@ -18,7 +18,7 @@ protected function attemptCombineProducts() orderDetails: [], productDetails: [], config: [ - 'products' => function() { + 'products' => function () { $product = Product::where( 'tax_group_id', '>', 0 ) ->whereRelation( 'unit_quantities', 'quantity', '>', 100 ) ->with( 'unit_quantities', fn( $query ) => $query->where( 'quantity', '>', 100 ) ) diff --git a/tests/Traits/WithOrderTest.php b/tests/Traits/WithOrderTest.php index 1aebc51a2..d1fac590b 100644 --- a/tests/Traits/WithOrderTest.php +++ b/tests/Traits/WithOrderTest.php @@ -312,7 +312,7 @@ public function attemptCreateAndEditOrderWithLowStock() date: ns()->date->now(), config: [ 'allow_quick_products' => false, - 'payments' => function( $details ) { + 'payments' => function ( $details ) { return [ [ 'identifier' => 'cash-payment', @@ -383,7 +383,7 @@ public function attemptCreateAndEditOrderWithGreaterQuantity() date: ns()->date->now(), config: [ 'allow_quick_products' => false, - 'payments' => function( $details ) { + 'payments' => function ( $details ) { return [ [ 'identifier' => 'cash-payment', @@ -451,7 +451,7 @@ public function attemptCreateOrderWithGroupedProducts( $data = [] ) $product = Product::type( Product::TYPE_GROUPED ) ->whereRelation( 'sub_items.product.unit_quantities', 'quantity', '>', 500 ) ->with([ 'unit_quantities' ]) - ->with( 'sub_items.product.unit_quantities', function( $query ) { + ->with( 'sub_items.product.unit_quantities', function ( $query ) { $query->where( 'quantity', '>', 500 ); }) ->get() @@ -462,7 +462,7 @@ public function attemptCreateOrderWithGroupedProducts( $data = [] ) * and the quantity on the grouped product * for a better computation later */ - $quantities = $product->sub_items->mapWithKeys( function( $value, $key ) use ( $productService, $unitService ) { + $quantities = $product->sub_items->mapWithKeys( function ( $value, $key ) use ( $productService, $unitService ) { $unit = $unitService->get( $value->unit_id ); $group = $unitService->getGroups( $unit->group_id ); $baseUnit = $unitService->getBaseUnit( $group ); @@ -520,7 +520,7 @@ public function attemptCreateOrderWithGroupedProducts( $data = [] ) /** * Step 2: We'll check if an history is created for the parent products */ - collect( $response[ 'data' ][ 'order' ][ 'products' ] )->each( function( $orderProduct ) use ( $response ) { + collect( $response[ 'data' ][ 'order' ][ 'products' ] )->each( function ( $orderProduct ) use ( $response ) { $this->assertTrue( ProductHistory::where( 'order_id', $response[ 'data' ][ 'order' ][ 'id' ] )->where( 'product_id', $orderProduct[ 'id' ] )->first() instanceof ProductHistory, sprintf( 'There is no product history for the parent product %s', $orderProduct[ 'name' ] ) @@ -541,7 +541,7 @@ public function attemptCreateOrderWithGroupedProducts( $data = [] ) ); $actualQuantity = $productService->getQuantity( - product_id: $productHistory->product_id, + product_id: $productHistory->product_id, unit_id: $productHistory->unit_id ); @@ -574,8 +574,8 @@ public function attemptRefundOrderWithGroupedProducts() $lastOrder = Order::orderBy( 'id', 'desc' )->first(); - $inventory = $lastOrder->products->map( function( $orderProduct ) use ( $productService, $unitService ) { - return $orderProduct->product->sub_items->mapWithKeys( function( $subItem ) use ( $orderProduct, $productService, $unitService ) { + $inventory = $lastOrder->products->map( function ( $orderProduct ) use ( $productService, $unitService ) { + return $orderProduct->product->sub_items->mapWithKeys( function ( $subItem ) use ( $orderProduct, $productService, $unitService ) { $unit = $unitService->get( $subItem->unit_id ); $unitGroup = $unitService->getGroups( $unit->group_id ); $baseUnit = $unitService->getBaseUnit( $unitGroup ); @@ -606,7 +606,7 @@ public function attemptRefundOrderWithGroupedProducts() 'payment' => [ 'identifier' => OrderPayment::PAYMENT_CASH, ], - 'products' => $lastOrder->products->map( function( OrderProduct $product ) { + 'products' => $lastOrder->products->map( function ( OrderProduct $product ) { return [ 'id' => $product->id, 'condition' => OrderProductRefund::CONDITION_UNSPOILED, @@ -621,10 +621,10 @@ public function attemptRefundOrderWithGroupedProducts() $lastOrder ->products() ->get() - ->each( function( OrderProduct $orderProduct, $index ) use ( $inventory, $productService ) { + ->each( function ( OrderProduct $orderProduct, $index ) use ( $inventory, $productService ) { $entry = $inventory[ $index ]; - $orderProduct->product->sub_items->each( function( $subItem ) use ( $entry, $orderProduct, $productService ) { + $orderProduct->product->sub_items->each( function ( $subItem ) use ( $entry, $orderProduct, $productService ) { $savedQuantity = $entry[ $subItem->product_id . '-' . $subItem->unit_id ]; $finalQuantity = $productService->computeSubItemQuantity( @@ -634,7 +634,7 @@ public function attemptRefundOrderWithGroupedProducts() ); $actualQuantity = $productService->getQuantity( - product_id: $subItem->product_id, + product_id: $subItem->product_id, unit_id: $subItem->unit_id ); @@ -1001,7 +1001,7 @@ public function processOrders( $currentDate, $callback ) $products = Product::where( 'type', '<>', Product::TYPE_GROUPED ) ->whereRelation( 'unit_quantities', 'quantity', '>', 1000 ) - ->with( 'unit_quantities', function( $query ) { + ->with( 'unit_quantities', function ( $query ) { $query->where( 'quantity', '>', 100 ); }) ->get() @@ -1010,7 +1010,7 @@ public function processOrders( $currentDate, $callback ) $shippingFees = $faker->randomElement([10, 15, 20, 25, 30, 35, 40]); $discountRate = $faker->numberBetween(0, 5); - $products = $products->map( function( $product ) use ( $faker, $taxService ) { + $products = $products->map( function ( $product ) use ( $faker, $taxService ) { $unitElement = $faker->randomElement( $product->unit_quantities ); $discountRate = 10; $quantity = $faker->numberBetween(1, 5); @@ -1035,7 +1035,7 @@ public function processOrders( $currentDate, $callback ) } return $data; - })->filter( function( $product ) { + })->filter( function ( $product ) { return $product[ 'quantity' ] > 0; }); @@ -1044,7 +1044,7 @@ public function processOrders( $currentDate, $callback ) */ $customer = Customer::get()->random(); - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) use ($currency) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) use ($currency) { $productSubTotal = $currency ->fresh( $product[ 'unit_price' ] ) ->multiplyBy( $product[ 'quantity' ] ) @@ -1251,7 +1251,7 @@ public function processOrders( $currentDate, $callback ) OrderProductRefund::CONDITION_UNSPOILED, ]); - $products = collect( $responseData[ 'data' ][ 'order' ][ 'products' ] )->map( function( $product ) use ( $faker, $productCondition ) { + $products = collect( $responseData[ 'data' ][ 'order' ][ 'products' ] )->map( function ( $product ) use ( $faker, $productCondition ) { return array_merge( $product, [ 'condition' => $productCondition, 'description' => __( 'A random description from the refund test' ), @@ -1412,14 +1412,14 @@ protected function attemptHoldAndCheckoutOrder() * and make sure there is a stock deducted. First we'll keep * the actual products stock */ - $stock = collect( $order[ 'products' ] )->mapWithKeys( function( $orderProduct ) use ( $productService ) { + $stock = collect( $order[ 'products' ] )->mapWithKeys( function ( $orderProduct ) use ( $productService ) { return [ $orderProduct[ 'id' ] => $productService->getQuantity( $orderProduct[ 'product_id' ], $orderProduct[ 'unit_id' ] ), ]; }); $order[ 'type' ] = [ 'identifier' => $order[ 'type' ] ]; - $order[ 'products' ] = collect( $order[ 'products' ] )->map( function( $product ) { + $order[ 'products' ] = collect( $order[ 'products' ] )->map( function ( $product ) { $product[ 'quantity' ] = 5; // we remove 1 quantity so it returns to inventory return $product; @@ -1437,7 +1437,7 @@ protected function attemptHoldAndCheckoutOrder() $response->assertJsonPath( 'data.order.payment_status', Order::PAYMENT_PAID ); - $stock->each( function( $quantity, $orderProductID ) use ( $productService ) { + $stock->each( function ( $quantity, $orderProductID ) use ( $productService ) { $orderProduct = OrderProduct::find( $orderProductID ); $newQuantity = $productService->getQuantity( $orderProduct->product_id, $orderProduct->unit_id ); @@ -1469,7 +1469,7 @@ protected function attemptHoldOrderAndCheckoutWithGroupedProducts() * Step 1: We want to make sure the system take in account * the remaining quantity while editing the order. */ - $product->sub_items()->with([ 'unit_quantity', 'product' ])->get()->each( function( ProductSubItem $subProduct ) use ( $productService ) { + $product->sub_items()->with([ 'unit_quantity', 'product' ])->get()->each( function ( ProductSubItem $subProduct ) use ( $productService ) { $productService->setQuantity( $subProduct->product->id, $subProduct->unit_quantity->unit_id, 25000 ); }); @@ -1524,7 +1524,7 @@ protected function attemptHoldOrderAndCheckoutWithGroupedProducts() * and make sure there is a stock deducted. First we'll keep * the actual products stock */ - $stock = collect( $order[ 'products' ] )->mapWithKeys( function( $orderProduct ) use ( $productService ) { + $stock = collect( $order[ 'products' ] )->mapWithKeys( function ( $orderProduct ) use ( $productService ) { $product = Product::with([ 'sub_items.product', 'sub_items.unit_quantity' ]) ->where( 'id', $orderProduct[ 'product_id' ] ) ->first(); @@ -1544,7 +1544,7 @@ protected function attemptHoldOrderAndCheckoutWithGroupedProducts() 'products' => Order::find( $order[ 'id' ] ) ->products() ->get() - ->map( function( $product ) { + ->map( function ( $product ) { $product->quantity = 4; return $product; @@ -1564,8 +1564,8 @@ protected function attemptHoldOrderAndCheckoutWithGroupedProducts() $response->assertStatus(200); $response->assertJsonPath( 'data.order.payment_status', Order::PAYMENT_PARTIALLY ); - $stock->each( function( $products, $parentProductID ) use ( $productService ) { - $products->each( function( $quantity, $subItemID ) use ( $productService ) { + $stock->each( function ( $products, $parentProductID ) use ( $productService ) { + $products->each( function ( $quantity, $subItemID ) use ( $productService ) { $productSubItem = ProductSubItem::with( 'product' )->find( $subItemID ); $newQuantity = $productService->getQuantity( $productSubItem->product->id, $productSubItem->unit_id ); $this->assertTrue( $newQuantity < $quantity, __( 'The quantity hasn\'t changed after selling a previously hold order.' ) ); @@ -1651,7 +1651,7 @@ protected function attemptCreateHoldOrder() * and make sure there is a stock deducted. First we'll keep * the actual products stock */ - $stock = collect( $order[ 'products' ] )->mapWithKeys( function( $orderProduct ) use ( $productService ) { + $stock = collect( $order[ 'products' ] )->mapWithKeys( function ( $orderProduct ) use ( $productService ) { return [ $orderProduct[ 'id' ] => $productService->getQuantity( $orderProduct[ 'product_id' ], $orderProduct[ 'unit_id' ] ), ]; @@ -1665,7 +1665,7 @@ protected function attemptCreateHoldOrder() 'products' => Order::find( $order[ 'id' ] ) ->products() ->get() - ->map( function( $product ) { + ->map( function ( $product ) { $product->quantity = 4; // we assume the remaining stock has at least 1 quantity remaining. return $product; @@ -1685,7 +1685,7 @@ protected function attemptCreateHoldOrder() $response->assertStatus(200); $response->assertJsonPath( 'data.order.payment_status', Order::PAYMENT_PARTIALLY ); - $stock->each( function( $quantity, $orderProductID ) use ( $productService ) { + $stock->each( function ( $quantity, $orderProductID ) use ( $productService ) { $orderProduct = OrderProduct::find( $orderProductID ); $newQuantity = $productService->getQuantity( $orderProduct->product_id, $orderProduct->unit_id ); $this->assertTrue( $newQuantity < $quantity, __( 'The quantity hasn\'t changed after selling a previously hold order.' ) ); @@ -1719,7 +1719,7 @@ protected function attemptDeleteOrder() 'customer_id' => $customer->id, ], config: [ - 'products' => function() { + 'products' => function () { return Product::withStockEnabled() ->whereRelation( 'unit_quantities', 'quantity', '>', 100 ) ->with( 'unit_quantities', fn( $query ) => $query->where( 'quantity', '>', 100 ) ) @@ -1748,7 +1748,7 @@ protected function attemptDeleteOrder() $products = $order->products ->filter( fn( $product ) => $product->product_id > 0 ) - ->map( function( $product ) use ( $productService ) { + ->map( function ( $product ) use ( $productService ) { $product->previous_quantity = $productService->getQuantity( $product->product_id, $product->unit_id ); return $product; @@ -1790,7 +1790,7 @@ protected function attemptDeleteOrder() */ $this->assertTrue( ! CashFlow::where( 'order_id', $order->id )->first() instanceof CashFlow, 'The cash flow hasn\'t been deleted.' ); - $products->each( function( OrderProduct $orderProduct ) use ( $productService ) { + $products->each( function ( OrderProduct $orderProduct ) use ( $productService ) { $originalProduct = $orderProduct->product; /** @@ -1852,10 +1852,10 @@ protected function attemptDeleteVoidedOrder() 'customer_id' => $customer->id, ], config: [ - 'products' => function() { + 'products' => function () { return Product::where( 'STOCK_MANAGEMENT', Product::STOCK_MANAGEMENT_ENABLED ) ->whereRelation( 'unit_quantities', 'quantity', '>', 100 ) - ->with( 'unit_quantities', function( $query ) { + ->with( 'unit_quantities', function ( $query ) { $query->where( 'quantity', '>', 100 ); }) ->where( 'type', '<>', Product::TYPE_GROUPED ) @@ -1887,7 +1887,7 @@ protected function attemptDeleteVoidedOrder() * We'll check if for each product on the order * there was a refund made for the returned goods */ - $order->products->each( function( $product ) { + $order->products->each( function ( $product ) { // every product that aren't refund if ( $product->refunded_products()->count() === 0 && $product->product()->first() instanceof Product ) { $history = ProductHistory::where( 'operation_type', ProductHistory::ACTION_VOID_RETURN ) @@ -1921,7 +1921,7 @@ protected function attemptDeleteVoidedOrder() * Step 2: We'll now check if by deleting the order * we still have the product history created. */ - $order->products->each( function( $product ) { + $order->products->each( function ( $product ) { // every product that aren't refund if ( $product->refunded_products()->count() === 0 ) { $history = ProductHistory::where( 'operation_type', ProductHistory::ACTION_RETURNED ) @@ -1954,7 +1954,7 @@ protected function attemptVoidOrder() 'customer_id' => $customer->id, ], config: [ - 'products' => function() { + 'products' => function () { return Product::where( 'STOCK_MANAGEMENT', Product::STOCK_MANAGEMENT_ENABLED ) ->whereRelation( 'unit_quantities', 'quantity', '>', 100 ) ->with( 'unit_quantities', fn( $query ) => $query->where( 'quantity', '>', 100 ) ) @@ -1985,7 +1985,7 @@ protected function attemptVoidOrder() * We'll check if for each product on the order * there was a refund made for the returned goods */ - $order->products->each( function( $product ) { + $order->products->each( function ( $product ) { // every product that aren't refund if ( $product->refunded_products()->count() === 0 && $product->product()->first() instanceof Product ) { $history = ProductHistory::where( 'operation_type', ProductHistory::ACTION_VOID_RETURN ) @@ -2048,7 +2048,7 @@ protected function attemptRefundOrder( $productQuantity, $refundQuantity, $payme $taxes = []; $taxGroup = TaxGroup::first(); if ( $taxGroup instanceof TaxGroup ) { - $taxes = $taxGroup->taxes->map( function( $tax ) { + $taxes = $taxGroup->taxes->map( function ( $tax ) { return [ 'tax_name' => $tax->name, 'tax_id' => $tax->id, @@ -2113,7 +2113,7 @@ protected function attemptRefundOrder( $productQuantity, $refundQuantity, $payme * We'll keep original products amounts and quantity * this means we're doing a full refund of price and quantities */ - $responseData[ 'data' ][ 'order' ][ 'products' ] = collect( $responseData[ 'data' ][ 'order' ][ 'products' ] )->map( function( $product ) use ( $refundQuantity ) { + $responseData[ 'data' ][ 'order' ][ 'products' ] = collect( $responseData[ 'data' ][ 'order' ][ 'products' ] )->map( function ( $product ) use ( $refundQuantity ) { $product[ 'condition' ] = OrderProductRefund::CONDITION_DAMAGED; $product[ 'quantity' ] = $refundQuantity; $product[ 'description' ] = __( 'Test : The product wasn\'t properly manufactured, causing external damage to the device during the shipment.' ); @@ -2199,7 +2199,7 @@ public function attemptCreateOrderWithInstalment() $shippingFees = $faker->randomElement([100, 150, 200, 250, 300, 350, 400]); $discountRate = $faker->numberBetween(1, 5); - $products = $products->map( function( $product ) use ( $faker ) { + $products = $products->map( function ( $product ) use ( $faker ) { $unitElement = $faker->randomElement( $product->unit_quantities ); return [ @@ -2215,7 +2215,7 @@ public function attemptCreateOrderWithInstalment() */ $customer = Customer::first(); - $subtotal = ns()->currency->getRaw( $products->map( function( $product ) { + $subtotal = ns()->currency->getRaw( $products->map( function ( $product ) { return Currency::raw( $product[ 'unit_price' ] ) * Currency::raw( $product[ 'quantity' ] ); })->sum() ); @@ -2381,7 +2381,7 @@ public function attemptCreateOrderWithInstalment() OrderInstalment::where( 'order_id', $order->id ) ->where( 'paid', false ) ->get() - ->each( function( $instalment ) use ( $order ) { + ->each( function ( $instalment ) use ( $order ) { $response = $this->withSession( $this->app[ 'session' ]->all() ) ->json( 'POST', 'api/nexopos/v4/orders/' . $order->id . '/instalments/' . $instalment->id . '/pay', [ 'payment_type' => OrderPayment::PAYMENT_CASH, @@ -2407,7 +2407,7 @@ protected function attemptCreatePartiallyPaidOrderWithAdjustment() $product = Product::withStockEnabled() ->whereRelation( 'unit_quantities', 'quantity', '>', 500 ) - ->with( 'unit_quantities', function( $query ) { + ->with( 'unit_quantities', function ( $query ) { $query->where( 'quantity', '>', 500 ); }) ->first(); @@ -2781,7 +2781,7 @@ private function retreiveProducts() ->shuffle() ->take(3); - return $products->map( function( $product ) { + return $products->map( function ( $product ) { $unitElement = $this->faker->randomElement( $product->unit_quantities ); $data = [ @@ -2799,7 +2799,7 @@ private function retreiveProducts() } return $data; - })->filter( function( $product ) { + })->filter( function ( $product ) { return $product[ 'quantity' ] > 0; }); } diff --git a/tests/Traits/WithProductTest.php b/tests/Traits/WithProductTest.php index bd978a0ed..28302a134 100644 --- a/tests/Traits/WithProductTest.php +++ b/tests/Traits/WithProductTest.php @@ -64,7 +64,7 @@ protected function attemptCreateProduct( $count = 5 ) 'tax_type' => $taxType, ], 'units' => [ - 'selling_group' => $unitGroup->units->map( function( $unit ) use ( $faker, $sale_price ) { + 'selling_group' => $unitGroup->units->map( function ( $unit ) use ( $faker, $sale_price ) { return [ 'sale_price_edit' => $sale_price, 'wholesale_price_edit' => $faker->numberBetween(20, 25), @@ -154,7 +154,7 @@ protected function attemptCreateGroupedProduct() $products = Product::where( 'type', Product::TYPE_DEMATERIALIZED ) ->limit(2) ->get() - ->map( function( $product ) use ( $faker ) { + ->map( function ( $product ) use ( $faker ) { /** * @var ProductUnitQuantity $unitQuantity */ @@ -203,7 +203,7 @@ protected function attemptCreateGroupedProduct() 'tax_type' => $taxType, ], 'units' => [ - 'selling_group' => $unitGroup->units->map( function( $unit ) use ( $faker, $sale_price ) { + 'selling_group' => $unitGroup->units->map( function ( $unit ) use ( $faker, $sale_price ) { return [ 'sale_price_edit' => $sale_price, 'wholesale_price_edit' => $faker->numberBetween(20, 25), @@ -236,8 +236,8 @@ protected function attemptCreateGroupedProduct() $this->assertTrue( count( $products ) === $product->sub_items->count(), 'Sub items aren\'t matching' ); - $matched = $product->sub_items->filter( function( $subItem ) use ( $products ) { - return collect( $products )->filter( function( $_product ) use ( $subItem ) { + $matched = $product->sub_items->filter( function ( $subItem ) use ( $products ) { + return collect( $products )->filter( function ( $_product ) use ( $subItem ) { $argument = ( (int) $_product[ 'unit_id' ] === (int) $subItem->unit_id && (int) $_product[ 'product_id' ] === (int) $subItem->product_id && @@ -260,7 +260,7 @@ protected function attemptAdjustmentByDeletion() { $productUnitQuantity = ProductUnitQuantity::where( 'quantity', '>', 10 ) ->with( 'product' ) - ->whereRelation( 'product', function( $query ) { + ->whereRelation( 'product', function ( $query ) { return $query->where( 'stock_management', Product::STOCK_MANAGEMENT_ENABLED ); }) ->first(); diff --git a/tests/Traits/WithReportTest.php b/tests/Traits/WithReportTest.php index 38c672506..fbb4ed383 100644 --- a/tests/Traits/WithReportTest.php +++ b/tests/Traits/WithReportTest.php @@ -76,7 +76,7 @@ protected function attemptTestSaleReport() $this->shouldRefund = false; $this->customDate = false; - $responses = $this->attemptPostOrder( function( $response, $responseData ) { + $responses = $this->attemptPostOrder( function ( $response, $responseData ) { // ... }); @@ -114,7 +114,7 @@ protected function attemptTestSaleReport() $this->count = 1; $this->shouldRefund = false; - $responses = $this->attemptPostOrder( function( $response, $responseData ) { + $responses = $this->attemptPostOrder( function ( $response, $responseData ) { // ... }); } diff --git a/tests/Traits/WithTaxTest.php b/tests/Traits/WithTaxTest.php index a16fa2d16..e699a40ce 100644 --- a/tests/Traits/WithTaxTest.php +++ b/tests/Traits/WithTaxTest.php @@ -31,7 +31,7 @@ protected function attemptProductTaxVariable() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'exclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id; @@ -39,7 +39,7 @@ protected function attemptProductTaxVariable() }), ]); - $this->assertCheck( $details, function( $order ) use ( $orderService ) { + $this->assertCheck( $details, function ( $order ) use ( $orderService ) { $this->assertEquals( (float) $orderService->getOrderProductsTaxes( Order::find( $order[ 'id' ] ) ), (float) $order[ 'products_tax_value' ], @@ -64,7 +64,7 @@ protected function attemptTaxProductVat() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'exclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id; @@ -72,7 +72,7 @@ protected function attemptTaxProductVat() }), ]); - $this->assertCheck( $details, function( $order ) use ( $orderService ) { + $this->assertCheck( $details, function ( $order ) use ( $orderService ) { $this->assertEquals( (float) $orderService->getOrderProductsTaxes( Order::find( $order[ 'id' ] ) ), (float) $order[ 'products_tax_value' ], @@ -93,7 +93,7 @@ protected function attemptFlatExpense() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'exclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id; @@ -111,7 +111,7 @@ protected function attemptInclusiveTax() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'inclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id; @@ -129,7 +129,7 @@ protected function attemptExclusiveTax() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'exclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id; @@ -152,7 +152,7 @@ protected function attemptVariableVat() $details = $testService->prepareOrder( ns()->date->now(), [ 'tax_group_id' => $taxGroup->id, 'tax_type' => 'exclusive', - 'taxes' => $taxGroup->taxes->map( function( $tax ) { + 'taxes' => $taxGroup->taxes->map( function ( $tax ) { $tax->tax_name = $tax->name; $tax->tax_id = $tax->id;