Skip to content

Commit

Permalink
Merge pull request #1598 from Blair2004/v4.8.x
Browse files Browse the repository at this point in the history
V4.8.x
  • Loading branch information
Blair2004 authored Aug 13, 2023
2 parents d65c1df + a431cc5 commit bba5a2d
Show file tree
Hide file tree
Showing 271 changed files with 988 additions and 4,226 deletions.
4 changes: 2 additions & 2 deletions app/Console/Commands/ComputeDailyReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
});

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/DoctorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
10 changes: 5 additions & 5 deletions app/Console/Commands/ExtractTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
});

Expand All @@ -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 );
Expand All @@ -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);

Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ModuleSymlinkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
});

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ModulesMigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
});
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/ProductCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 );
});

Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]);
}
Expand Down Expand Up @@ -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 ) ) {
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/CashFlowHistoryCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
14 changes: 7 additions & 7 deletions app/Crud/CouponCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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/' ),
Expand Down
6 changes: 3 additions & 3 deletions app/Crud/CustomerAccountCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/CustomerCouponCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
6 changes: 3 additions & 3 deletions app/Crud/CustomerCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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}' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/CustomerGroupCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/CustomerOrderCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/CustomerRewardCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/ExpenseCategoryCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/ExpenseCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/GlobalProductHistoryCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/HoldOrderCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/OrderCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/#',
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/OrderInstalmentCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/PaymentTypeCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/ProcurementCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public function bulkAction( Request $request )
*/
public function getLinks(): array
{
return [
return [
'list' => 'procurements',
'create' => 'procurements/create',
'edit' => 'procurements/edit',
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/ProcurementProductCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
2 changes: 1 addition & 1 deletion app/Crud/ProductCategoryCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/' ),
Expand Down
Loading

0 comments on commit bba5a2d

Please sign in to comment.