mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Implement PHP CS Fixer and a coding standard to follow (#471)
* Create PHP CS Fixer config and add to CI workflow * Run php cs fixer on project * Add newline at end of file * Update to use PHP CS Fixer v3 * Run v3 config on project * Run seperate config in CI
This commit is contained in:
@ -33,7 +33,7 @@ class AddressFactory extends Factory
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'fax' => $this->faker->phoneNumber,
|
||||
'type' => $this->faker->randomElement([Address::BILLING_TYPE, Address::SHIPPING_TYPE]),
|
||||
'user_id' => User::factory()
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class CompanyFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'unique_hash' => str_random(60),
|
||||
'name' => $this->faker->name
|
||||
'name' => $this->faker->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class CustomFieldFactory extends Factory
|
||||
'label' => $this->faker->name,
|
||||
'order' => $this->faker->randomDigitNotNull,
|
||||
'is_required' => $this->faker->randomElement([true, false]),
|
||||
'model_type'=> $this->faker->randomElement(['Customer', 'Invoice', 'Estimate', 'Expense', 'Payment']),
|
||||
'model_type' => $this->faker->randomElement(['Customer', 'Invoice', 'Estimate', 'Expense', 'Payment']),
|
||||
'slug' => function (array $item) {
|
||||
return clean_slug($item['model_type'], $item['label']);
|
||||
},
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\CustomFieldValue;
|
||||
use Crater\Models\CustomField;
|
||||
use Crater\Models\CustomFieldValue;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class EmailLogFactory extends Factory
|
||||
'mailable_type' => $this->faker->randomElement([Invoice::class, Estimate::class, Payment::class]),
|
||||
'mailable_id' => function (array $log) {
|
||||
return $log['mailable_type']::factory();
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class EstimateItemFactory extends Factory
|
||||
},
|
||||
'discount' => function (array $estimate) {
|
||||
return $estimate['discount_type'] == 'percentage' ? (($estimate['discount_val'] * $estimate['total']) / 100) : $estimate['discount_val'];
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ class ExpenseCategoryFactory extends Factory
|
||||
return [
|
||||
'name' => $this->faker->word,
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'description' => $this->faker->text
|
||||
'description' => $this->faker->text,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\Expense;
|
||||
use Crater\Models\User;
|
||||
use Crater\Models\ExpenseCategory;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ExpenseFactory extends Factory
|
||||
@ -29,7 +29,7 @@ class ExpenseFactory extends Factory
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'amount' => $this->faker->randomDigitNotNull,
|
||||
'notes' => $this->faker->text,
|
||||
'attachment_receipt' => null
|
||||
'attachment_receipt' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,10 +25,10 @@ class FileDiskFactory extends Factory
|
||||
'name' => $this->faker->word,
|
||||
'driver' => 'local',
|
||||
'set_as_default' => false,
|
||||
'credentials' => [
|
||||
'credentials' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
]
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\Invoice;
|
||||
use Crater\Models\User;
|
||||
use Crater\Models\InvoiceTemplate;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class InvoiceFactory extends Factory
|
||||
@ -121,7 +121,7 @@ class InvoiceFactory extends Factory
|
||||
return $invoice['total'];
|
||||
},
|
||||
'notes' => $this->faker->text(80),
|
||||
'unique_hash' => str_random(60)
|
||||
'unique_hash' => str_random(60),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\Item;
|
||||
use Crater\Models\User;
|
||||
use Crater\Models\Unit;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ItemFactory extends Factory
|
||||
@ -28,7 +28,7 @@ class ItemFactory extends Factory
|
||||
'description' => $this->faker->text,
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'price' => $this->faker->randomDigitNotNull,
|
||||
'unit_id' => Unit::factory()
|
||||
'unit_id' => Unit::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ class NoteFactory extends Factory
|
||||
return [
|
||||
'type' => $this->faker->randomElement(['Invoice', 'Estimate', 'Payment']),
|
||||
'name' => $this->faker->word,
|
||||
'notes' => $this->faker->text
|
||||
'notes' => $this->faker->text,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ class PaymentFactory extends Factory
|
||||
'payment_date' => $this->faker->date('Y-m-d', 'now'),
|
||||
'notes' => $this->faker->text(80),
|
||||
'amount' => $this->faker->randomDigitNotNull,
|
||||
'payment_number' => 'PAY-' . Payment::getNextPaymentNumber('PAY'),
|
||||
'payment_number' => 'PAY-'.Payment::getNextPaymentNumber('PAY'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ class TaxFactory extends Factory
|
||||
return TaxType::find($item['tax_type_id'])->name;
|
||||
},
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'amount' => $this->faker->randomDigitNotNull
|
||||
'amount' => $this->faker->randomDigitNotNull,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,11 +24,11 @@ class TaxTypeFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word,
|
||||
'company_id' => User::where('role','super admin')->first()->company_id,
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'percent' => $this->faker->numberBetween($min = 0, $max = 100),
|
||||
'description' => $this->faker->text,
|
||||
'compound_tax' => 0,
|
||||
'collective_tax' => 0
|
||||
'collective_tax' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class UserFactory extends Factory
|
||||
'company_id' => User::find(1)->company_id,
|
||||
'role' => 'super admin',
|
||||
'password' => Hash::make('secret'),
|
||||
'currency_id' => Currency::first()->id
|
||||
'currency_id' => Currency::first()->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user