PHP code example of pmatseykanets / artisan-io

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

    

pmatseykanets / artisan-io example snippets


// config/app.php
'providers' => [
    ...
    ArtisanIo\ArtisanIoServiceProvider::class,
],

protected $commands = [
    \ArtisanIo\Console\ImportDelimitedCommand::class,
];

Schema::create('employees', function (Blueprint $table) {
    $table->increments('id');
    $table->string('email')->unique();
    $table->string('firstname', 60)->nullable();
    $table->string('lastname', 60)->nullable();
    $table->string('phone', 10)->nullable();
    $table->date('employed_on')->nullable();
    $table->timestamps();
});




namespace App;

use Illuminate\Database\Eloquent\Model;

class Employee extends Model
{
    protected $table = 'employees';

    protected $fillable = [
        'email',
        'firstname',
        'lastname',
        'phone',
        'employed_on'
    ];
}



return [
    'email' => '2|max:60',
    'lastname' => 'string|min:2|max:60',
    'phone' => 'digits:10|regex:/[2-9][0-9]{2}[2-9][0-9]{6}/'
    'employed_on' => 'date_format:m/d/Y|after:2010-07-15|before:'.date('Y-m-d', strtotime('tomorrow'));
];