TRF Certest first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vanguard\Country;
|
||||
|
||||
class CountryFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Country::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'country_code' => $this->faker->countryCode,
|
||||
'iso_3166_2' => strtoupper($this->faker->randomLetter.$this->faker->randomLetter),
|
||||
'iso_3166_3' => $this->faker->countryISOAlpha3,
|
||||
'name' => $this->faker->country,
|
||||
'region_code' => 123,
|
||||
'sub_region_code' => 123,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PermissionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = \Vanguard\Permission::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => Str::random(5),
|
||||
'display_name' => implode(' ', $this->faker->words(2)),
|
||||
'description' => substr($this->faker->paragraph, 0, 191),
|
||||
'removable' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RoleFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = \Vanguard\Role::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => Str::random(5),
|
||||
'display_name' => implode(' ', $this->faker->words(2)),
|
||||
'description' => $this->faker->sentence,
|
||||
'removable' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Vanguard\Role;
|
||||
use Vanguard\User;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'email' => $this->faker->email,
|
||||
'password' => '$2y$10$A2A/2IIP.jsLzIiAPr.enuzxzRWzIzLWifqNU33PWPBGx6mkJFz72', // 123123123
|
||||
'first_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'phone' => $this->faker->phoneNumber,
|
||||
'avatar' => null,
|
||||
'address' => $this->faker->address,
|
||||
'country_id' => function () {
|
||||
return $this->faker->randomElement(\Vanguard\Country::pluck('id')->toArray());
|
||||
},
|
||||
'role_id' => function () {
|
||||
return Role::factory()->create()->id;
|
||||
},
|
||||
'status' => \Vanguard\Support\Enum\UserStatus::ACTIVE,
|
||||
'birthday' => $this->faker->date(),
|
||||
'email_verified_at' => (string) now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user