70208d2157
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
33 lines
783 B
PHP
33 lines
783 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\voucher;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class VoucherFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = voucher::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
return [
|
|
'memo' => $this->faker->word(),
|
|
'code' => Str::random(36),
|
|
'credits' => $this->faker->numberBetween(100, 1000),
|
|
'uses' => $this->faker->numberBetween(1, 1000),
|
|
'expires_at' => now()->addDays($this->faker->numberBetween(1, 90))->format('d-m-Y'),
|
|
];
|
|
}
|
|
}
|