analysators added

This commit is contained in:
Anatoliy Poloz
2023-12-18 14:36:32 +03:00
parent e9c4647f26
commit 92a54106ef
166 changed files with 32767 additions and 1222 deletions

View File

@@ -2,8 +2,8 @@
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\BlogPost;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
@@ -12,6 +12,7 @@ use Illuminate\Support\Str;
class BlogPostFactory extends Factory
{
protected $model = BlogPost::class;
/**
* Define the model's default state.
*
@@ -20,8 +21,9 @@ class BlogPostFactory extends Factory
public function definition()
{
$imagePath = storage_path('app/public');
$curImage = $this->faker->image($imagePath . "/blog_posts", 360, 360, 'animals', true, true, 'cats', true, 'jpg');
$curImage = $this->faker->image($imagePath.'/blog_posts', 360, 360, 'animals', true, true, 'cats', true, 'jpg');
$curImage = Str::replace($imagePath, '', $curImage);
return [
'state' => $this->faker->randomElement(['active', 'archived']),
'image' => $curImage,
@@ -29,13 +31,13 @@ class BlogPostFactory extends Factory
'youtube_url' => $this->faker->url(),
'created_at' => $this->faker->dateTimeBetween('-1 week', '+1 week'),
'updated_at' => $this->faker->dateTimeBetween('-1 week', '+1 week'),
'title'=> $this->faker->realText($this->faker->numberBetween(10, 20)),
'title' => $this->faker->realText($this->faker->numberBetween(10, 20)),
];
}
public function some()
{
User::orderBy('created_at', 'desc')->limit(20)->get()->map(function($user) {
User::orderBy('created_at', 'desc')->limit(20)->get()->map(function ($user) {
$newBlogPosts = BlogPost::factory()->count(3)->create();
$newBlogPosts->map(function ($post) use ($user) {
$user->author_of_blog_post()->attach($post->id);