mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	init crater
This commit is contained in:
		
							
								
								
									
										34
									
								
								database/factories/EstimateItemFactory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								database/factories/EstimateItemFactory.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| <?php | ||||
|  | ||||
| /** @var \Illuminate\Database\Eloquent\Factory $factory */ | ||||
|  | ||||
| use Laraspace\EstimateItem; | ||||
| use Laraspace\Item; | ||||
| use Faker\Generator as Faker; | ||||
| use Laraspace\User; | ||||
|  | ||||
| $factory->define(EstimateItem::class, function (Faker $faker) { | ||||
|     return [ | ||||
|         'item_id' => function () { | ||||
|             return factory(Item::class)->create()->id; | ||||
|         }, | ||||
|         'name' => function (array $item) { | ||||
|             return Item::find($item['item_id'])->name; | ||||
|         }, | ||||
|         'description' => function (array $item) { | ||||
|             return Item::find($item['item_id'])->description; | ||||
|         }, | ||||
|         'price' => function (array $item) { | ||||
|             return Item::find($item['item_id'])->price; | ||||
|         }, | ||||
|         'quantity' => $faker->randomDigitNotNull, | ||||
|         'company_id' => User::find(1)->company_id, | ||||
|         'discount_type' => 'fixed', | ||||
|         'tax' => $faker->randomDigitNotNull, | ||||
|         'discount_val' => 0, | ||||
|         'total' => function (array $item) { | ||||
|             return ($item['price'] * $item['quantity']); | ||||
|         }, | ||||
|         'discount' => 0 | ||||
|     ]; | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user