PHP code example of pxlrbt / laravel-database-state

1. Go to this page and download the library: Download pxlrbt/laravel-database-state 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/ */

    

pxlrbt / laravel-database-state example snippets



namespace Database\States;

use App\Models\User;

class UserState
{
    public function __invoke()
    {
        if (! User::where('user', '[email protected]')->exists()) {
            User::forceCreate([
                'name' => 'Example User',
                'email' => '[email protected]',
                'email_verified_at' => now(),
                'password' => '$2y$10$etbrxzCyYhs598Abu6XdAeJ7GZQvDhOvE70XnRtoO25bvif1uEvSi',
            ]);
        }
    }
}