Laravel Inverse Seed Generator

Related tags

Database iseed
Overview

Inverse seed generator (iSeed) is a Laravel package that provides a method to generate a new seed file based on data from the existing database table.

Build Status Latest Stable Version Total Downloads Analytics

Installation

1. Require with Composer

composer require orangehill/iseed

Laravel 5.3.7 and below or Laravel 4 need specific version

composer require orangehill/iseed:2.2 # Laravel 5.3.7 and below
composer require orangehill/iseed:1.1 # Laravel 4

2. Add Service Provider (Laravel 5.4 and below)

Latest Laravel versions have auto dicovery and automatically add service provider - if you're using 5.4.x and below, remember to add it to providers array at /app/config/app.php:

// ...
Orangehill\Iseed\IseedServiceProvider::class,

Artisan command options

[table_name]

Mandatory parameter which defines which table/s will be used for seed creation. Use CSV notation for multiple tables. Seed file will be generated for each table.

Examples:

php artisan iseed my_table
php artisan iseed my_table,another_table

classnameprefix & classnamesuffix

Optionally specify a prefix or suffix for the Seeder class name and file name. This is useful if you want to create an additional seed for a table that has an existing seed without overwriting the existing one.

Examples:

php artisan iseed my_table --classnameprefix=Customized

outputs CustomizedMyTableSeeder.php

php artisan iseed my_table,another_table --classnameprefix=Customized

outputs CustomizedMyTableSeeder.php and CustomizedAnotherTableSeeder.php

php artisan iseed my_table --classnamesuffix=Customizations

outputs MyTableCustomizationsSeeder.php

php artisan iseed my_table,another_table --classnamesuffix=Customizations

outputs MyTableCustomizationsSeeder.php and AnotherTableCustomizationsSeeder.php

force

Optional parameter which is used to automatically overwrite any existing seeds for desired tables

Example: The following command will overwrite UsersTableSeeder.php if it already exists in laravel's seeds directory.

php artisan iseed users --force

dumpauto

Optional boolean parameter that controls the execution of composer dump-autoload command. Defaults to true.

Example that will stop composer dump-autoload from execution:

php artisan iseed users --dumpauto=false

clean

Optional parameter which will clean app/database/seeds/DatabaseSeeder.php before creating new seed class.

Example:

php artisan iseed users --clean

database

Optional parameter which specifies the DB connection name.

Example:

php artisan iseed users --database=mysql2

max

Optional parameter which defines the maximum number of entries seeded from a specified table. In case of multiple tables, limit will be applied to all of them.

Example:

php artisan iseed users --max=10

chunksize

Optional parameter which defines the size of data chunks for each insert query.

Example:

php artisan iseed users --chunksize=100

orderby

Optional parameter which defines the column which will be used to order the results by, when used in conjunction with the max parameter that allows you to set the desired number of exported database entries.

Example:

artisan iseed users --max=10 --orderby=id

direction

Optional parameter which allows you to set the direction of the ordering of results; used in conjuction with orderby parameter.

Example:

artisan iseed users --max=10 --orderby=id --direction=desc

exclude

Optional parameter which accepts comma separated list of columns that you'd like to exclude from tables that are being exported. In case of multiple tables, exclusion will be applied to all of them.

Example:

php artisan iseed users --exclude=id
php artisan iseed users --exclude=id,created_at,updated_at

prerun

Optional parameter which assigns a laravel event name to be fired before seeding takes place. If an event listener returns false, seed will fail automatically. You can assign multiple preruns for multiple table names by passing an array of comma separated DB names and respectively passing a comma separated array of prerun event names.

Example: The following command will make a seed file which will fire an event named 'someEvent' before seeding takes place.

php artisan iseed users --prerun=someEvent

The following example will assign someUserEvent to users table seed, and someGroupEvent to groups table seed, to be executed before seeding.

php artisan iseed users,groups --prerun=someUserEvent,someGroupEvent

The following example will only assign a someGroupEvent to groups table seed, to be executed before seeding. Value for the users table prerun was omitted here, so users table seed will have no prerun event assigned.

php artisan iseed users,groups --prerun=,someGroupEvent

postrun

Optional parameter which assigns a laravel event name to be fired after seeding takes place. If an event listener returns false, seed will be executed, but an exception will be thrown that the postrun failed. You can assign multiple postruns for multiple table names by passing an array of comma separated DB names and respectively passing a comma separated array of postrun event names.

Example: The following command will make a seed file which will fire an event named 'someEvent' after seeding was completed.

php artisan iseed users --postrun=someEvent

The following example will assign someUserEvent to users table seed, and someGroupEvent to groups table seed, to be executed after seeding.

php artisan iseed users,groups --postrun=someUserEvent,someGroupEvent

The following example will only assign a someGroupEvent to groups table seed, to be executed after seeding. Value for the users table postrun was omitted here, so users table seed will have no postrun event assigned.

php artisan iseed users,groups --postrun=,someGroupEvent

noindex

By using --noindex the seed can be generated as a non-indexed array. The use case for this feature is when you need to merge two seed files.

Example:

php artisan iseed users --noindex

Usage

To generate a seed file for your users table simply call: \Iseed::generateSeed('users', 'connectionName', 'numOfRows');. connectionName and numOfRows are not required arguments.

This will create a file inside a /database/seeds (/app/database/seeds for Laravel 4), with the contents similar to following example:

<?php

// File: /database/seeds/UsersTableSeeder.php

class UsersTableSeeder extends Seeder {

    /**
     * Auto generated seed file
     *
     * @return void
        */
    public function run()
    {
        \DB::table('users')->truncate();
        \DB::table('users')->insert(array (
            0 =>
            array (
                'id' => '1',
                'email' => '[email protected]',
                'password' => '$2y$10$tUGCkQf/0NY3w1l9sobGsudt6UngnoVXx/lUoh9ElcSOD0ERRkK9C',
                'permissions' => NULL,
                'activated' => '1',
                'activation_code' => NULL,
                'activated_at' => NULL,
                'last_login' => NULL,
                'persist_code' => NULL,
                'reset_password_code' => NULL,
                'first_name' => NULL,
                'last_name' => NULL,
                'created_at' => '2013-06-11 07:47:40',
                'updated_at' => '2013-06-11 07:47:40',
            ),
            1 =>
            array (
                'id' => '2',
                'email' => '[email protected]',
                'password' => '$2y$10$ImNvsMzK/BOgNSYgpjs/3OjMKMHeA9BH/hjl43EiuBuLkZGPMuZ2W',
                'permissions' => NULL,
                'activated' => '1',
                'activation_code' => NULL,
                'activated_at' => NULL,
                'last_login' => '2013-06-11 07:54:57',
                'persist_code' => '$2y$10$C0la8WuyqC6AU2TpUwj0I.E3Mrva8A3tuVFWxXN5u7jswRKzsYYHK',
                'reset_password_code' => NULL,
                'first_name' => NULL,
                'last_name' => NULL,
                'created_at' => '2013-06-11 07:47:40',
                'updated_at' => '2013-06-11 07:54:57',
            ),
        ));
    }

}

This command will also update /database/seeds/DatabaseSeeder.php (/app/database/seeds/DatabaseSeeder.php for Laravel 4) to include a call to this newly generated seed class.

If you wish you can define custom iSeed template in which all the calls will be placed. You can do this by using #iseed_start and #iseed_end templates anywhere within /database/seeds/DatabaseSeeder.php (/app/database/seeds/DatabaseSeeder.php for Laravel 4), for example:

<?php

// File: /database/seeds/DatabaseSeeder.php
class DatabaseSeeder extends Seeder {

    /**
     * Run the database seeds.
     *
     * @return void
        */
    public function run()
    {
        Eloquent::unguard();

        if(App::environment() == "local")
        {
            throw new \Exception('Only run this from production');
        }

        #iseed_start

        // here all the calls for newly generated seeds will be stored.

        #iseed_end
    }

}

Alternatively you can run Iseed from the command line using Artisan, e.g. php artisan iseed users. For generation of multiple seed files comma separated list of table names should be send as an argument for command, e.g. php artisan iseed users,posts,groups.

In case you try to generate seed file that already exists command will ask you a question whether you want to overwrite it or not. If you wish to overwrite it by default use --force Artisan Command Option, e.g. php artisan iseed users --force.

If you wish to clear iSeed template you can use Artisan Command Option --clean, e.g. php artisan iseed users --clean. This will clean template from app/database/seeds/DatabaseSeeder.php before creating new seed class.

You can specify db connection that will be used for creation of new seed files by using Artisan Command Option --database=connection_name, e.g. php artisan iseed users --database=mysql2.

To limit number of rows that will be exported from table use Artisan Command Option --max=number_of_rows, e.g. php artisan iseed users --max=10. If you use this option while exporting multiple tables specified limit will be applied to all of them.

To (re)seed the database go to the Terminal and run Laravel's db:seed command (php artisan db:seed).

Please note that some users encountered a problem with large DB table exports (error when seeding from table with many records). The issue was solved by splitting input data into smaller chunks of elements per insert statement. As you may need to change the chunk size value in some extreme cases where DB table has a large number of columns, the chunk size is configurable in iSeed's config.php file:

'chunk_size' => 500 // Maximum number of rows per insert statement
Comments
  • I've updated to 5.4 and now getting segmantation problem

    I've updated to 5.4 and now getting segmantation problem

    Hi, we were using this iseed perfectly with 5.3 now its not working with 5.4

    when I run this php artisan iseed product_types I get this as an error Segmentation fault: 11

    opened by ghost 12
  • Fail in laravel 5.3

    Fail in laravel 5.3

    Hi, I use " php artisan iseed my_table " but only get `<?php

    use Illuminate\Database\Seeder;

    class my_tableTableSeeder extends Seeder {

    /**
     * Auto generated seed file
     *
     * @return void
     */
    public function run()
    {
        \DB::table('my_table')->delete();
    }
    

    } ` please help thanks

    opened by agrodriguez 8
  • iseed not writing connection info to seed files?

    iseed not writing connection info to seed files?

    I have a setup where I use two databases, mysql and mysql2. When I reverse seed from table 2 (mysql2), using the --database=mysql2 command-line option, a mostly correct seed file is generated, but it does not seed back into the proper table.

    The problem seems to be that iseed does not output "connection" information. It outputs:

    \DB::table('events')->delete();
    \DB::table('events')->insert(array(...));
    

    Where it should have output this:

    \DB::connection('mysql2')->table('events')->delete();
    \DB::connection('mysql2')->table('events')->insert(array(...));
    

    I think this is a bug in iseed, but I am not absolutely sure :-)

    I am using PHP v7.2, Laravel v5.6, and Percona v5.7 (MySQL compatible like MariaDB).

    opened by archfrog 7
  • use ->delete instead of truncate() and other issue

    use ->delete instead of truncate() and other issue

    Hello,

    I just tested your package and saves alot of work. thanks! ;) meanwhile i've detected 1 issue and have another suggestion:

    1st in seed.stub use \DB::table('{{table}}')->truncate(); instead of \DB::table('{{table}}')->delete(); delete() does not reset the autoincrements fields and there is no need to save undo states. truncate is faster (I use truncate because i do reset all database at once on every migrate:refresh).

    in iseed.php you have: if(strpos($content, '$this->call('UsersTableSeeder')')===false) $content = preg_replace("/(run().+?)}/us", "$1\t$this->call('{$className}');\n\t}", $content);

    should be if(strpos($content, "$this->call('{$className}')")===false) $content = preg_replace("/(run().+?)}/us", "$1\t$this->call('{$className}');\n\t}", $content);

    without this you are allways adding same class to DatabaseSeeder.php

    opened by Puralogica 6
  • Support laravel 8 by default

    Support laravel 8 by default

    Related to #166

    This PR aims to support laravel 8 by default. To do this the following changes are made:

    1. Add namespace Database\Seeders; namespace to the seed stub.
    2. Change config to point to the default database/seeders/ directory over the laravel 7 database/seeds
    3. Change the Stubs directory to stubs

    With regards to 3:

    The default laravel stubs dir is called stubs, for iSeed this is Stubs. I would like to rename this as to make changing the seed stub easier.

    I strongly suspect this pr requires a major version bump.

    opened by dinandmentink 5
  • add a new optional input

    add a new optional input "orderby"

    hi I need to generate the last 100 records from table. so I add a new option input "orderby".

    ex:

    $ php artisan iseed users --force --max=100 --orderby=id
    

    will generate seed file from users table and order by id DESC

    opened by GimmyHchs 5
  • Laravel 5.3 changes

    Laravel 5.3 changes

    Hi everyone!

    Laravel 5.3 is around the corner and this package needs some changes to work with it.

    See the getData() method:

        /**
         * Get the Data
         * @param  string $table
         * @return Array
         */
        public function getData($table, $max)
        {
            if (!$max) {
                return \DB::connection($this->databaseName)->table($table)->get();
            }
    
            return \DB::connection($this->databaseName)->table($table)->limit($max)->get();
        }
    

    Prior to L5.3 this method returns an array but in L5.3+ it returns a Collection that needs to be casted as an array.

    Dirty quick fix to allow this package to work with both L5.3 and prior versions.

        /**
         * Repacks data read from the database
         * @param  array|object $data
         * @return array
         */
        public function repackSeedData($data)
        {
            // Check if $data is an array
            if (!is_array($data)) {
                $data = $data->toArray();
            }
    
            $dataArray = array();
            if (is_array($data)) {
                foreach ($data as $row) {
                    $rowArray = array();
    
                    foreach ($row as $columnName => $columnValue) {
                        $rowArray[$columnName] = $columnValue;
                    }
                    $dataArray[] = $rowArray;
                }
            }
            return $dataArray;
        }
    

    Cheers

    opened by rjsworking 5
  • why my git-gui could not track this repository iseed?

    why my git-gui could not track this repository iseed?

    why my git-gui could not track this repository iseed?

    I change my composer.json as "orangehill/iseed": "dev-master", and update. all files of iseed have been downloaded and placed in my_project/vendor/orangehill. and then, I will push all files to my git server, but My git-gui could not track this respository iseed . even though I run: git add -f ./vendor/* git-gui didn't track iseed any files either.

    Is there any one meet this situation? Who know why? I need help, thanks in advance

    git-gui

    opened by jianhuawang 4
  • IseedCommand::handle() does not exist

    IseedCommand::handle() does not exist

    Laravel 5.5 \Orangehill\Iseed\IseedServiceProvider::class is on the providers array (config/app.php) "orangehill/iseed": "dev-master" on composer.json

    Command: php artisan iseed table_name Error: [ReflectionException]
    Method Orangehill\Iseed\IseedCommand::handle() does not exist

    opened by tomerBZ 4
  • iseed is not available on artisan

    iseed is not available on artisan

    Laravel 5.4, here is my composer.json

    {
      "name": "laravel/laravel",
      "description": "The Laravel Framework.",
      "keywords": [
        "framework",
        "laravel"
      ],
      "license": "MIT",
      "type": "project",
      "minimum-stability": "dev",
      "require": {
        "php": ">=5.6.4",
        "doctrine/dbal": "^2.5",
        "laracasts/utilities": ">=2.1",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",
        "league/flysystem": ">=1.0.37",
        "orangehill/iseed": "dev-master",
        "predis/predis": "^1.1",
        "talyssonoc/react-laravel": "dev-master",
        "tcg/voyager": "dev-master"
      },
      "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.3",
        "fzaninotto/faker": "~1.4",
        "laravel/homestead": "^5.1",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7",
        "phpspec/phpspec": "^3.0"
      },
      "autoload": {
        "classmap": [
          "database"
        ],
        "psr-4": {
          "LinguobotAdmin\\": "app/"
        }
      },
      "autoload-dev": {
        "psr-4": {
          "Tests\\": "tests/"
        }
      },
      "scripts": {
        "post-root-package-install": [
          "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
          "php artisan key:generate"
        ],
        "post-install-cmd": [
          "Illuminate\\Foundation\\ComposerScripts::postInstall",
          "php artisan optimize",
          "echo 'Change .env file credentials to your environment, so database and caching connections would work'"
        ],
        "post-update-cmd": [
          "Illuminate\\Foundation\\ComposerScripts::postUpdate",
          "php artisan ide-helper:generate",
          "php artisan ide-helper:meta",
          "php artisan optimize"
        ]
      },
      "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
      }
    }
    
    opened by juslintek 4
  • Allow user to explicitly set the class name and file name to be used

    Allow user to explicitly set the class name and file name to be used

    php artisan iseed things will automatically generate the file ThingsTableSeeder.php containing a class named ThingsTableSeeder. In some cases, user may have an existing ThingsTableSeeder.php file and/or ThingsTableSeeder class which they do not want to overwrite (for example, when expanding upon an existing package that runs it's own seeders upon install - but user wants to add rows to that table).

    This commit allows user to explicitly specify the file/class name, rather than it being generated automatically from the table name.

    Syntax: php artisan iseed things:AdditionalThingsTableSeeder will create AdditionalThingsTableSeeder.php containing the class AdditionalThingsTableSeeder. CSV support remains intact: php artisan iseed things_one:AdditionalThingsOneTableSeeder,things_two:AdditionalThingsTwoTableSeeder works as expected

    opened by mattrabe 3
  •   Call to undefined method Laravel\Lumen\Application::configPath()

    Call to undefined method Laravel\Lumen\Application::configPath()

    Good Morning..

    I installed the library and the following error occurred when running

    php artisan iseed contact_types,bank_account_types,banking_holder_types,states,countries,payment_methods,brands,products,localizations,contacts,company_anticipations,acquirer_periods,acquirer_tariff_periods,acquirer_tariff_periods

    Call to undefined method Laravel\Lumen\Application::configPath()

    Step by step

    composer require orangehill/iseed composer require orangehill/iseed:2.2

    my app.php file

    <?php
    
    return [
    
        /*
        |--------------------------------------------------------------------------
        | Application Name
        |--------------------------------------------------------------------------
        |
        | This value is the name of your application. This value is used when the
        | framework needs to place the application's name in a notification or
        | any other location as required by the application or its packages.
        |
        */
    
        'name' => env('APP_NAME', 'Laravel'),
    
        /*
        |--------------------------------------------------------------------------
        | Application Environment
        |--------------------------------------------------------------------------
        |
        | This value determines the "environment" your application is currently
        | running in. This may determine how you prefer to configure various
        | services the application utilizes. Set this in your ".env" file.
        |
        */
    
        'env' => env('APP_ENV', 'production'),
    
        /*
        |--------------------------------------------------------------------------
        | Application Debug Mode
        |--------------------------------------------------------------------------
        |
        | When your application is in debug mode, detailed error messages with
        | stack traces will be shown on every error that occurs within your
        | application. If disabled, a simple generic error page is shown.
        |
        */
    
        'debug' => env('APP_DEBUG', false),
    
        /*
        |--------------------------------------------------------------------------
        | Application URL
        |--------------------------------------------------------------------------
        |
        | This URL is used by the console to properly generate URLs when using
        | the Artisan command line tool. You should set this to the root of
        | your application so that it is used when running Artisan tasks.
        |
        */
    
        'url' => env('APP_URL', 'http://localhost'),
    
        'asset_url' => env('ASSET_URL', null),
    
        /*
        |--------------------------------------------------------------------------
        | Application Timezone
        |--------------------------------------------------------------------------
        |
        | Here you may specify the default timezone for your application, which
        | will be used by the PHP date and date-time functions. We have gone
        | ahead and set this to a sensible default for you out of the box.
        |
        */
    
        'timezone' => 'America/Sao_Paulo',
        
        /*
        |--------------------------------------------------------------------------
        | Application Locale Configuration
        |--------------------------------------------------------------------------
        |
        | The application locale determines the default locale that will be used
        | by the translation service provider. You are free to set this value
        | to any of the locales which will be supported by the application.
        |
        */
    
        'locale' => 'en',
    
        /*
        |--------------------------------------------------------------------------
        | Application Fallback Locale
        |--------------------------------------------------------------------------
        |
        | The fallback locale determines the locale to use when the current one
        | is not available. You may change the value to correspond to any of
        | the language folders that are provided through your application.
        |
        */
    
        'fallback_locale' => 'en',
    
        /*
        |--------------------------------------------------------------------------
        | Faker Locale
        |--------------------------------------------------------------------------
        |
        | This locale will be used by the Faker PHP library when generating fake
        | data for your database seeds. For example, this will be used to get
        | localized telephone numbers, street address information and more.
        |
        */
    
        'faker_locale' => 'en_US',
    
        /*
        |--------------------------------------------------------------------------
        | Encryption Key
        |--------------------------------------------------------------------------
        |
        | This key is used by the Illuminate encrypter service and should be set
        | to a random, 32 character string, otherwise these encrypted strings
        | will not be safe. Please do this before deploying an application!
        |
        */
    
        'key' => env('APP_KEY'),
    
        'cipher' => 'AES-256-CBC',
    
        /*
        |--------------------------------------------------------------------------
        | Autoloaded Service Providers
        |--------------------------------------------------------------------------
        |
        | The service providers listed here will be automatically loaded on the
        | request to your application. Feel free to add your own services to
        | this array to grant expanded functionality to your applications.
        |
        */
    
        'providers' => [
    
            /*
             * Laravel Framework Service Providers...
             */
            Illuminate\Auth\AuthServiceProvider::class,
            Illuminate\Broadcasting\BroadcastServiceProvider::class,
            Illuminate\Bus\BusServiceProvider::class,
            Illuminate\Cache\CacheServiceProvider::class,
            Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
            Illuminate\Cookie\CookieServiceProvider::class,
            Illuminate\Database\DatabaseServiceProvider::class,
            Illuminate\Encryption\EncryptionServiceProvider::class,
            Illuminate\Filesystem\FilesystemServiceProvider::class,
            Illuminate\Foundation\Providers\FoundationServiceProvider::class,
            Illuminate\Hashing\HashServiceProvider::class,
            Illuminate\Mail\MailServiceProvider::class,
            Illuminate\Notifications\NotificationServiceProvider::class,
            Illuminate\Pagination\PaginationServiceProvider::class,
            Illuminate\Pipeline\PipelineServiceProvider::class,
            Illuminate\Queue\QueueServiceProvider::class,
            Illuminate\Redis\RedisServiceProvider::class,
            Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
            Illuminate\Session\SessionServiceProvider::class,
            Illuminate\Translation\TranslationServiceProvider::class,
            Illuminate\Validation\ValidationServiceProvider::class,
            Illuminate\View\ViewServiceProvider::class,
    
            /*
             * Package Service Providers...
             */
    
            /*
             * Application Service Providers...
             */
            App\Providers\AppServiceProvider::class,
            App\Providers\AuthServiceProvider::class,
            // App\Providers\BroadcastServiceProvider::class,
            App\Providers\EventServiceProvider::class,
            App\Providers\RouteServiceProvider::class,
            App\Providers\ApiServiceProvider::class,
        ],
    
        /*
        |--------------------------------------------------------------------------
        | Class Aliases
        |--------------------------------------------------------------------------
        |
        | This array of class aliases will be registered when this application
        | is started. However, feel free to register as many as you wish as
        | the aliases are "lazy" loaded so they don't hinder performance.
        |
        */
    
        'aliases' => [
    
            'App' => Illuminate\Support\Facades\App::class,
            'Arr' => Illuminate\Support\Arr::class,
            'Artisan' => Illuminate\Support\Facades\Artisan::class,
            'Auth' => Illuminate\Support\Facades\Auth::class,
            'Blade' => Illuminate\Support\Facades\Blade::class,
            'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
            'Bus' => Illuminate\Support\Facades\Bus::class,
            'Cache' => Illuminate\Support\Facades\Cache::class,
            'Config' => Illuminate\Support\Facades\Config::class,
            'Cookie' => Illuminate\Support\Facades\Cookie::class,
            'Crypt' => Illuminate\Support\Facades\Crypt::class,
            'DB' => Illuminate\Support\Facades\DB::class,
            'Eloquent' => Illuminate\Database\Eloquent\Model::class,
            'Event' => Illuminate\Support\Facades\Event::class,
            'File' => Illuminate\Support\Facades\File::class,
            'Gate' => Illuminate\Support\Facades\Gate::class,
            'Hash' => Illuminate\Support\Facades\Hash::class,
            'Lang' => Illuminate\Support\Facades\Lang::class,
            'Log' => Illuminate\Support\Facades\Log::class,
            'Mail' => Illuminate\Support\Facades\Mail::class,
            'Notification' => Illuminate\Support\Facades\Notification::class,
            'Password' => Illuminate\Support\Facades\Password::class,
            'Queue' => Illuminate\Support\Facades\Queue::class,
            'Redirect' => Illuminate\Support\Facades\Redirect::class,
            'Redis' => Illuminate\Support\Facades\Redis::class,
            'Request' => Illuminate\Support\Facades\Request::class,
            'Response' => Illuminate\Support\Facades\Response::class,
            'Route' => Illuminate\Support\Facades\Route::class,
            'Schema' => Illuminate\Support\Facades\Schema::class,
            'Session' => Illuminate\Support\Facades\Session::class,
            'Storage' => Illuminate\Support\Facades\Storage::class,
            'Str' => Illuminate\Support\Str::class,
            'URL' => Illuminate\Support\Facades\URL::class,
            'Validator' => Illuminate\Support\Facades\Validator::class,
            'View' => Illuminate\Support\Facades\View::class,
            'Api' => App\Facades\Api::class,
        ],
    
    ];
    
    

    Laravel = Lumen (5.8.12) (Laravel Components 5.8.*)

    opened by gmmaraccini 0
  • fix: When using the --database parameter, specify connection for the …

    fix: When using the --database parameter, specify connection for the …

    When using the --database parameter specify a connection different from the default one, seeder file didn't specifies the same connection, that might cause an unexpected error and would make CRITICAL mistake(if there's a table has same name in the default connection).

    /**
    * @todo append records to exists table only instead of deleting table before seeding.
    **/
    - \DB::table('bar')->delete();
    + \DB::connection('foo')->table('bar')->delete();
    -\DB::table('bar')->insert(array (
    +\DB::connection('foo')->table('bar')->insert(array (
    
    opened by Endy-c 0
  • Namespace requires changing if custom path used in config

    Namespace requires changing if custom path used in config

    Love the fact you can change the path for where your seeders get written, however if they're inside a package the namespace also needs changing from

    namespace Database\Seeders;

    to

    namespace Author\PackageName\path\path

    Could namespace be another option added to config?

    opened by fri3ndly 2
  • New maintainers?

    New maintainers?

    Hi, I'd like to propose assigning new maintainers for this project, and I suggest @csoutham and @puretec who have more recent versions of this code base, or it can be someone else among the top active contributors willing, any takers?

    question 
    opened by yazeed 2
  • "php artisan iseed:all" or "php artisan iseed" is not working for iseed all table.

    It shows those error message: There are no commands defined in the "iseed" namespace. or Not enough arguments (missing: "tables").

    opened by sujanustc 0
Releases(v3.0.2)
  • v3.0.2(Feb 13, 2022)

  • v3.0.1(Jan 14, 2021)

  • v3.0(Dec 14, 2020)

    This release aims to add a native laravel 8 support. To do this the following changes were made:

    1. Add namespace Database\Seeders; namespace to the seed stub.
    2. Change config to point to the default database/seeders/ directory over the laravel 7 database/seeds
    3. Change the Stubs directory to stubs

    Since some breaking changes were introduced, the version is bumped to a major release.

    Source code(tar.gz)
    Source code(zip)
  • v2.6.4(Sep 10, 2020)

  • v2.6.3(Mar 6, 2020)

  • v2.6.2(Sep 9, 2019)

  • v2.6.1(Dec 7, 2018)

    Added chunksize optional parameter which defines the size of data chunks for each insert query. Helps with issue described in https://github.com/orangehill/iseed/issues/4#issuecomment-380324859

    Source code(tar.gz)
    Source code(zip)
  • v2.6(Oct 1, 2018)

    Optionally specify a prefix or suffix for the Seeder class name and file name. This is useful if you want to create an additional seed for a table that has an existing seed without overwriting the existing one.

    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(Oct 5, 2017)

    In order to support L55, the IseedCommand now has a handle() method for Laravel v5.5 and a fire() method for older Laravel versions.

    https://github.com/laravel/framework/blob/master/CHANGELOG-5.5.md laravel/framework#19827 laravel/framework#20024

    Source code(tar.gz)
    Source code(zip)
  • v2.5(Jul 13, 2017)

    By using --orderby and --direction parameters you can now set the column which will be used for results ordering, and the direction to order by (ASC/DESC). This works great when you want to limit the number of exported database entries using the --max parameter.

    Source code(tar.gz)
    Source code(zip)
  • v2.4(May 9, 2017)

    By using --noindex the seed can be generated as a non-indexed array. The use case for this feature is when you need to merge two seed files.

    Source code(tar.gz)
    Source code(zip)
  • v2.3(Dec 22, 2016)

    • Feature: Implemented a composer dump-autoload feature
    • Feature: Added the exclude columns functionality
    • Fix: iSeed is now using PHP_EOL instead of \r\n for line endings
    • Fix: Added a ::class notation to improve IDE navigation
    • Fix: Formated main class files as per PSR-2 standards
    • Fix: Fixed the failed table check issue when using multiple databases.
    Source code(tar.gz)
    Source code(zip)
  • v2.2(Sep 14, 2016)

  • v2.1(Jan 22, 2016)

  • v2.0(Mar 18, 2015)

  • v1.1(Feb 19, 2015)

    New features: Confirm method that prevents existing seed files from being overwritten. Specify maximum numer of rows to be exported. Multiple tables export.

    Fixed a number of smaller issues.

    Source code(tar.gz)
    Source code(zip)
Owner
Orange Hill Development
Orange Hill Development
Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.

Laravel Migrations Generator Generate Laravel Migrations from an existing database, including indexes and foreign keys! Upgrading to Laravel 5.4 Pleas

Bernhard Breytenbach 3.3k Dec 30, 2022
Laravel Code Generator based on MySQL Database

Laravel Code Generator Do you have a well structed database and you want to make a Laravel Application on top of it. By using this tools you can gener

Tuhin Bepari 311 Dec 28, 2022
The fastest pure PHP database framework with a powerful static code generator, supports horizontal scale up, designed for PHP7

Maghead 4.0.x IS CURRENTLY UNDER HEAVY DEVELOPMENT, API IS NOT STABLE Maghead is an open-source Object-Relational Mapping (ORM) designed for PHP7. Mag

Maghead 477 Dec 24, 2022
A Laravel package to output a specific sql to your favourite debugging tool. The supported log output is Laravel Telescope, Laravel Log, Ray, Clockwork, Laravel Debugbar and your browser.

Laravel showsql A Laravel package to output a specific sql to your favourite debugging tool, your browser or your log file. Use case You often want to

Dieter Coopman 196 Dec 28, 2022
Laravel Thermite is an extended PostgreSQL Laravel database driver to connect to a CockroachDB cluster.

Laravel Thermite Laravel Thermite is an extended PostgreSQL Laravel database driver to connect to a CockroachDB cluster. ?? Supporting If you are usin

Renoki Co. 9 Nov 15, 2022
This project is about import CSV to Laravel with Laravel Excel library.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Abraham Víctor Zaragoza Rodríguez 1 Nov 20, 2021
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style OR

The Laravel Components 2.5k Dec 27, 2022
Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.

Baum Baum is an implementation of the Nested Set pattern for Laravel 5's Eloquent ORM. For Laravel 4.2.x compatibility, check the 1.0.x branch branch

Estanislau Trepat 2.2k Jan 3, 2023
Driver to seamlessly integrate the Backup Manager into Laravel applications.

Laravel Driver for the Database Backup Manager This package pulls in the framework agnostic Backup Manager and provides seamless integration with Lara

Backup Manager 636 Dec 30, 2022
Effective tree structures in Laravel 4-5

This is a Laravel 4-8 package for working with trees in relational databases. Laravel 5.7, 5.8, 6.0, 7.0, 8.0 is supported since v5 Laravel 5.5, 5.6 i

Alexander Kalnoy 3.3k Jan 6, 2023
Adjacency List’ed Closure Table database design pattern implementation for the Laravel framework.

ClosureTable This is a database manipulation package for the Laravel 5.4+ framework. You may want to use it when you need to store and operate hierarc

Yan Ivanov 441 Dec 11, 2022
A drop-in library for certain database functionality in Laravel, that allows for extra features that may never make it into the main project.

Eloquence Eloquence is a package to extend Laravel's base Eloquent models and functionality. It provides a number of utilities and classes to work wit

Kirk Bushell 470 Dec 8, 2022
Oracle DB driver for Laravel 4|5|6|7|8 via OCI8

Oracle DB driver for Laravel 4|5|6|7|8 via OCI8 Laravel-OCI8 Laravel-OCI8 is an Oracle Database Driver package for Laravel. Laravel-OCI8 is an extensi

Arjay Angeles 751 Jan 6, 2023
A package to backup your Laravel app

A modern backup solution for Laravel apps This Laravel package creates a backup of your application. The backup is a zip file that contains all files

Spatie 5.1k Jan 1, 2023
A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Laravel Doctrine ORM A drop-in Doctrine ORM 2 implementation for Laravel 5+ $scientist = new Scientist( 'Albert', 'Einstein' ); $scientist->a

Laravel Doctrine 777 Dec 17, 2022
A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

Laravel MongoDB This package adds functionalities to the Eloquent model and Query builder for MongoDB, using the original Laravel API. This library ex

Jens Segers 6.3k Jan 5, 2023
[Package] Multi-tenant Database Schema Manager for Laravel

Multi-tenant Database Schema Manager for Laravel Tenanti allow you to manage multi-tenant data schema and migration manager for your Laravel applicati

Orchestra Platform 580 Dec 5, 2022
Laravel 5 - Repositories to abstract the database layer

Laravel 5 Repositories Laravel 5 Repositories is used to abstract the data layer, making our application more flexible to maintain. See versions: 1.0.

Anderson Andrade 4k Jan 6, 2023
A Redis based, fully automated and scalable database cache layer for Laravel

Lada Cache A Redis based, fully automated and scalable database cache layer for Laravel Contributors wanted! Have a look at the open issues and send m

Matt 501 Dec 30, 2022