2017 © Pedro Peláez
 

library database

Bootstraps the illuminate/database package

image

davek1312/database

Bootstraps the illuminate/database package

  • Monday, May 8, 2017
  • by davek1312
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

davek1312/database

Bootstraps the illuminate/database package., (*1)

Installation

The package is available on Packagist, you can install it using Composer., (*2)

composer require davek1312/database

Configuration

Copy vendor\davek1312\database\davek1312 into your application's root directory., (*3)

Database Connections

Add your database connections into the connections array in davek1312\database\config\database.php in your application's root directory., (*4)

<?php 
return [

    // Default connection that will be used
    'default' => davek1312_env('DATABASE_DEFAULT', 'default'),

    // Migrations table name
    'migrations' => davek1312_env('DATABASE_MIGRATIONS', 'migrations'),

    'connections' => [

        'example_connection' => [
            'driver' => 'mysql',
            'host' => davek1312_env('EXAMPLE_CONNECTION_HOST', 'default_database_host'),
            'port' => davek1312_env('EXAMPLE_CONNECTION_PORT', 'default_database_port'),
            'database' => davek1312_env('EXAMPLE_CONNECTION_DATABASE', 'default_database_name'),
            'username' => davek1312_env('EXAMPLE_CONNECTION_USERNAME', 'default_database_username'),
            'password' => davek1312_env('EXAMPLE_CONNECTION_PASSWORD', 'default_database_password'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
        ],

    ], 

];

Eloquent Usage

You can view the Eloquent documentation on Laravel., (*5)

Migrations

Creating a migration

vendor\bin\davek1312-console migration:make name --path= --table= --create

Register Migrations

To register your migrations view the davek1312\app documentation., (*6)

Running The Migrations

vendor\bin\davek1312-console migration:migrate

Rolling Back The Migrations

vendor\bin\davek1312-console migration:rollback

Resetting The Database

vendor\bin\davek1312-console migration:reset

Validation

You can validate your Eloquent models when saving/updating the model. You can either extend our version of Eloquent's model or use our model validation trait., (*7)

Extend Model

<?php

namespace YourNamespace;

class YourModel extends \Davek1312\Database\Model {
}

Use Validation Trait

<?php

namespace YourNamespace;

class YourModel extends \Illuminate\Database\Eloquent\Model {

    use \Davek1312\Database\Traits\ModelValidation;
}

Model Validation Configuration

You can view the valdation documentation to see what rules are available and to implement custom messages., (*8)

<?php

namespace YourNamespace;

class YourModel extends \Davek1312\Database\Model {
    /**
     * @var array
     */
    protected $fillable = ['name'];
    /**
     * @var array
     */
    protected $validationRules = ['name' => 'required'];
    /**
     * The message for any customer validation rules specific to the model. 
     * 
     * @var array
     */
    protected $customValidationMessages = [];
    /**
     * The locale for the validation messages. Will default to the app's locale.
     * 
     * @var string
     */
    protected $validationLocale;
}

Validation Methods

<?php

$model = new YourModel($data);
// Will only save if isValid() returns true. Applies to saving/updating/creating events.
$model->save();

// Checks if the model passes validation
$model->isValid();

//Returns all the validation messages for failed rules
$model->getValidationMessages();

The Versions

08/05 2017

dev-master

9999999-dev https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

08/05 2017

v0.7.3

0.7.3.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

08/05 2017

v0.7.2

0.7.2.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

07/05 2017

v0.7.1

0.7.1.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

07/05 2017

v0.6.3

0.6.3.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

07/05 2017

v0.6.2

0.6.2.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap validation eloquent illuminate

29/04 2017
09/04 2017

v0.5.2

0.5.2.0 https://bitbucket.org/davek1312/database

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap eloquent illuminate

02/04 2017

v0.5.1

0.5.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database migrations bootstrap eloquent illuminate

02/04 2017

v0.4.4

0.4.4.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

02/04 2017

v0.4.3

0.4.3.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

01/04 2017

v0.4.2

0.4.2.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

29/03 2017

v0.4.1

0.4.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

26/03 2017

v0.3.5

0.3.5.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

26/03 2017

v0.3.4

0.3.4.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

26/03 2017

v0.3.3

0.3.3.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

26/03 2017

v0.3.2

0.3.2.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

26/03 2017

v0.3.1

0.3.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

25/03 2017

v0.2.1

0.2.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

20/03 2017

v0.1.1

0.1.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate

25/02 2017

v0.0.1

0.0.1.0

Bootstraps the illuminate/database package

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Kelly

database bootstrap eloquent illuminate