Home screen improvements, testing for role, work on user/account models

This commit is contained in:
Deon George
2022-04-21 14:41:26 +10:00
parent 40d12b906b
commit 796c72dd09
18 changed files with 528 additions and 241 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Rtm>
*/
class RtmFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'id' => $this->faker->numberBetween(2048,65535),
//* 'site_id', // Needs to be passed in
//* 'account_id', // Needs to be passed in
// 'name',
//* 'parent_id', // Needs to be passed in
];
}
}

View File

@@ -1,23 +1,49 @@
<?php
use Faker\Generator as Faker;
namespace Database\Factories;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
use App\Models\Country;
use App\Models\Language;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
$factory->define(App\Models\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
// Create Dependencies - should be loaded by seeding.
$co = Country::findOrFail(61);
$lo = Language::findOrFail(1);
return [
'id' => $this->faker->numberBetween(2048,65535),
// 'created_at'
// 'updated_at'
//* 'site_id', // Needs to be passed in
'email' => $this->faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => Str::random(10),
'active' => 1,
// 'title'
'firstname' => $this->faker->name,
'lastname' => $this->faker->name,
'country_id' => $co->id,
// 'address1'
// 'address2'
// 'city'
// 'state'
// 'postcode'
'emailable' => true,
// 'parent_id''
'language_id' => $lo->id,
];
}
}