PHP code example of capsulescodes / laravel-population
1. Go to this page and download the library: Download capsulescodes/laravel-population 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/ */
capsulescodes / laravel-population example snippets
bash
php artisan populate
bash
INFO Migration changes :
create_users_table .......................................................................................................................... DONE
INFO Table 'users' has changes.
⇂ delete column : 'fullname' => type : varchar
⇂ create column : 'firstname' => type : varchar
⇂ create column : 'lastname' => type : varchar
┌ Do you want to proceed on populating the 'users' table? ─────┐
│ Yes │
└──────────────────────────────────────────────────────────────┘
┌ How would you like to convert the records for the column 'varchar' of type 'string'? 'fn( $attribute, $model ) => $attribute' ┐
│ fn( $a, $b ) => explode( ' ', $b->fullname )[ 0 ] │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌ How would you like to convert the records for the column 'lastname' of type 'varchar'? 'fn( $attribute, $model ) => $attribute' ┐
│ fn( $a, $b ) => explode( ' ', $b->fullname )[ 1 ] │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
INFO Population succeeded.
bash
php artisan populate:rollback
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.