PHP code example of smousss / laravel-factorize

1. Go to this page and download the library: Download smousss/laravel-factorize library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smousss / laravel-factorize example snippets


namespace Database\Factories;

use …

class ThreadFactory extends Factory
{
    public function definition()
    {
        return [
            'title' => fake()->sentence(),
            'slug' => fake()->slug(),
            'content' => fake()->paragraph(),
        ];
    }

    public function withUser(): static
    {
        return $this->state(function () {
            return [
                'user_id' => User::factory(),
            ];
        });
    }

    …
}
bash
php artisan vendor:publish --tag=factorize-config