2017 © Pedro Peláez
 

library laravel-support

Laravel 5 support classes

image

patinthehat/laravel-support

Laravel 5 support classes

  • Sunday, April 2, 2017
  • by patinthehat
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

## LaravelSupport

Various support classes for Laravel 5+., (*1)


Installation

Install with composer:, (*2)

composer require patinthehat/laravel-support, (*3)


Classes

ExtendedSeeder

ExtendedSeeder is an extended version of the Seeder class and provides easy foreign key check enable/disable and table truncating. It also allows for easy access to Faker., (*4)

Methods
  • getFaker() - returns an instance of Faker\Factory (see Faker).
  • init($tableName, $disableForeignKeyChecks = true, $deleteAllTableEntries = true) - call at the beginning of run().
  • cleanup() - call at the end of run().
Sample Usage:
use App\Support\ExtendedSeeder;
use App\User;

class UserTableSeeder extends ExtendedSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //disable foreign key checks, delete all existing table entries
        $this->init('users', true, true); 
        //seed the table
        $text = $this->getFaker()->text();
        $this->cleanup();
    }
}

ExtendedMigration

ExtendedMigration is an extended version of the Migration class and provides easy foreign key creation/deletion., (*5)

Methods

--, (*6)

Sample Usage:
use LaravelSupport\Database\ExtendedMigration;

class CreateForeignKeys extends ExtendedMigration
{
    //define the FKs
    protected $foreignKeyDefinitions = [
        'info.author_id' => ['authors.id', 'cascade', 'cascade'],
        'info.book_id' => ['books.id', null, null],
        'table2.test_id' => 'tests.id',
        'myinfo.publisher_id' => null, //creates FK on 'publishers.id'
    ];

    //automatically create/delete FKs
    protected $autoCreateDefinedKeys = true;
    protected $autoDeleteDefinedKeys = true;
}

License

LaravelSupport is available under the MIT License., (*7)

The Versions

02/04 2017

dev-master

9999999-dev

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

02/04 2017

v1.2.2

1.2.2.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

02/04 2017

v1.2.1

1.2.1.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

30/03 2017

v1.2.0

1.2.0.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

20/02 2017

v1.1.0

1.1.0.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

17/02 2017

v1.0.2

1.0.2.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

17/02 2017

v1.0.1

1.0.1.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ

17/02 2017

v1.0.0

1.0.0.0

Laravel 5 support classes

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Patrick Organ