PHP code example of strawberrydev / wimd

1. Go to this page and download the library: Download strawberrydev/wimd 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/ */

    

strawberrydev / wimd example snippets




namespace Database\Seeders;

use Wimd\Template\WimdDatabaseSeeder;

class DatabaseSeeder extends WimdDatabaseSeeder
{
    public function run()
    {
        $this->call([
            UserSeeder::class,
            CategoriesSeeder::class,
            ProductsSeeder::class,
            TagsSeeder::class,
            ProductTagSeeder::class,
            UserDetailsSeeder::class,
            ReviewsSeeder::class,
        ]);

        // Optional
        $this->displayWimdReport();
    }
}

$this->displayWimdReport();



namespace Database\Seeders;

use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Wimd\Template\WimdSeeder;

class UserSeeder extends WimdSeeder
{
    protected function prepare(): void
    {
        $this->totalItems = 1000;
        $this->fullItems = 1000000;
        $this->lightItems = 250;
        $this->batchSize = 77;
    }

    protected function seed(): void
    {
        $admin = [
            'name' => 'Admin User',
            'email' => '[email protected]',
            'password' => Hash::make('password'),
            'created_at' => now(),
            'updated_at' => now(),
        ];

        $this->insertItem('users', $admin);

        $this->createWithFactory(User::class, $this->totalItems - 1);
    }
}

$this->batchInsert('users', $usersArray, $batchSize);

$this->insertItem('users', $userData);

$this->createWithFactory(User::class, 50);
bash
php artisan vendor:publish --tag=wimd-config