Upgrade to Laravel 8

This commit is contained in:
Jonny Barnes 2020-10-17 17:15:06 +01:00
parent 1ad58f10c5
commit 57186c3e2e
27 changed files with 945 additions and 1003 deletions

View file

@ -1,24 +1,31 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$factory->define(App\Models\User::class, function (Faker $faker) {
static $password;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
return [
'name' => mb_strtolower($faker->firstName),
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => Str::random(10),
];
});
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'password' => bcrypt('password'),
'remember_token' => Str::random(10),
];
}
}