Upgrade to Laravel 8
This commit is contained in:
parent
1ad58f10c5
commit
57186c3e2e
27 changed files with 945 additions and 1003 deletions
|
@ -1,12 +1,35 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Bookmark;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
$factory->define(Bookmark::class, function (Faker $faker) {
|
||||
return [
|
||||
'url' => $faker->url,
|
||||
'name' => $faker->sentence,
|
||||
'content' => $faker->text,
|
||||
];
|
||||
});
|
||||
use App\Models\Bookmark;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class BookmarkFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Bookmark::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
return [
|
||||
'url' => $this->faker->url,
|
||||
'name' => $this->faker->sentence,
|
||||
'content' => $this->faker->text,
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,36 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Like;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
$factory->define(Like::class, function (Faker $faker) {
|
||||
return [
|
||||
'url' => $faker->url,
|
||||
'author_name' => $faker->name,
|
||||
'author_url' => $faker->url,
|
||||
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $faker->realtext() . '</div></div></body></html>',
|
||||
];
|
||||
});
|
||||
use App\Models\Like;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LikeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Like::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
return [
|
||||
'url' => $this->faker->url,
|
||||
'author_name' => $this->faker->name,
|
||||
'author_url' => $this->faker->url,
|
||||
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $this->faker->realtext() . '</div></div></body></html>',
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
29
database/factories/MicropubClientFactory.php
Normal file
29
database/factories/MicropubClientFactory.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class MicropubClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MicropubClient::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'client_url' => $this->faker->url,
|
||||
'client_name' => $this->faker->company,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,14 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Note;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
$factory->define(Note::class, function (Faker $faker) {
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
return [
|
||||
'note' => $faker->paragraph,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
class NoteFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Note::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
return [
|
||||
'note' => $this->faker->paragraph,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
32
database/factories/PlaceFactory.php
Normal file
32
database/factories/PlaceFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Place;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PlaceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Place::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company,
|
||||
'description' => $this->faker->sentence,
|
||||
'latitude' => $this->faker->latitude,
|
||||
'longitude' => $this->faker->longitude,
|
||||
'external_urls' => $this->faker->url,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,10 +1,28 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Tag;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
$factory->define(Tag::class, function (Faker $faker) {
|
||||
return [
|
||||
'tag' => $faker->word,
|
||||
];
|
||||
});
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Tag::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'tag' => $this->faker->word,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue