mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Add File based templates
This commit is contained in:
committed by
Mohit Panjwani
parent
00961bcae1
commit
d1dd704cdf
@ -3,7 +3,6 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\Estimate;
|
||||
use Crater\Models\EstimateTemplate;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
@ -76,7 +75,7 @@ class EstimateFactory extends Factory
|
||||
'company_id' => User::where('role', 'super admin')->first()->company_id,
|
||||
'user_id' => User::factory()->create(['role' => 'customer'])->id,
|
||||
'status' => Estimate::STATUS_DRAFT,
|
||||
'estimate_template_id' => EstimateTemplate::find(1) ?? EstimateTemplate::factory(),
|
||||
'template_name' => 'estimate1',
|
||||
'sub_total' => $this->faker->randomDigitNotNull,
|
||||
'total' => $this->faker->randomDigitNotNull,
|
||||
'discount_type' => $this->faker->randomElement(['percentage', 'fixed']),
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\EstimateTemplate;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EstimateTemplateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = EstimateTemplate::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'path' => $this->faker->word,
|
||||
'view' => $this->faker->word,
|
||||
'name' => $this->faker->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,6 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\Invoice;
|
||||
use Crater\Models\InvoiceTemplate;
|
||||
use Crater\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
@ -101,7 +100,7 @@ class InvoiceFactory extends Factory
|
||||
'invoice_number' => 'INV-'.Invoice::getNextInvoiceNumber('INV'),
|
||||
'reference_number' => Invoice::getNextInvoiceNumber('INV'),
|
||||
'user_id' => User::factory()->create(['role' => 'customer'])->id,
|
||||
'invoice_template_id' => InvoiceTemplate::find(1) ?? InvoiceTemplate::factory(),
|
||||
'template_name' => 'invoice1',
|
||||
'status' => Invoice::STATUS_DRAFT,
|
||||
'tax_per_item' => 'NO',
|
||||
'discount_per_item' => 'NO',
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Crater\Models\InvoiceTemplate;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class InvoiceTemplateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = InvoiceTemplate::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'path' => $this->faker->word,
|
||||
'view' => $this->faker->word,
|
||||
'name' => $this->faker->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user