roger-russel / schemaum
A Laravel helper to work with pre indexed databases and tables
v1.2.0
2018-10-08 20:16 UTC
Requires
- php: >=5.6.4
Requires (Dev)
- codeception/codeception: ^2.4
- illuminate/events: 5.6.*
- laravel/database: 5.3.*
README
Install
composer require roger-russel/schemaum
API
/**
* @param string $databaseLike [ like string on database ]
* @param string $userLik [ like string on database ]
* @param function [This function is the very same which is required on Laravel]
*/
Schemas::table($databaseLike, $userLik, function(Blueprint $table){});
Usage
use Schemaum\Schemas;
Schemas::table('database_%','users_%', function(Blueprint $table){
$table->string('phone');
});
Example of use
<?php
use Schemaum\Schemas; // use Schemas instead of Laravel Schema
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterSomeTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//Firts parameter is database like, and the second one is table like
Schemas::table('database_%','users_%', function(Blueprint $table){
$table->string('phone');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//Firts parameter is database like, and the second one is table like
Schemas::table('database_%','users_%',function(Blueprint $table){
$table->dropColumn('phone');
});
}
}