Skip to content

Commit

Permalink
Code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jun 2, 2024
1 parent e114789 commit 63b024e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Database/Factories/CouponFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Igniter\Coupons\Database\Factories;

use Igniter\Flame\Database\Factories\Factory;

class CouponFactory extends Factory
{
protected $model = \Igniter\Coupons\Models\Coupon::class;

public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
'code' => $this->faker->unique()->regexify('[A-Z0-9]{10}'),
'type' => 'P',
'discount' => $this->faker->randomFloat(2, 1, 100),
'status' => 1,
'validity' => 'forever',
];
}
}
2 changes: 2 additions & 0 deletions src/Models/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Igniter\Coupons\Models;

use Carbon\Carbon;
use Igniter\Flame\Database\Factories\HasFactory;
use Igniter\Flame\Database\Model;
use Igniter\Local\Models\Concerns\Locationable;
use Igniter\System\Models\Concerns\Switchable;
Expand All @@ -14,6 +15,7 @@
*/
class Coupon extends Model
{
use HasFactory;
use Locationable;
use Switchable;

Expand Down

0 comments on commit 63b024e

Please sign in to comment.