38 Commits

Author SHA1 Message Date
Ismo Vuorinen
83a07b225e Added new tests, updated composer.json and added auto-discovery 2017-11-22 11:57:25 +02:00
Ismo Vuorinen
9ca5301b77 CS 2017-11-22 11:56:49 +02:00
Ismo Vuorinen
5d3aab30c0 Merge branch 'release/1.2.0' into develop 2017-10-19 10:58:52 +03:00
Ismo Vuorinen
06039cdcfd Changelog 2017-10-19 10:58:37 +03:00
Ismo Vuorinen
fcb274d3d6 Upgrading required PHP version to >=7.0
This bump is because it took really long time to find suitable packages
for PHP 5.6.
2017-10-19 10:40:05 +03:00
Ismo Vuorinen
8bc16492f6 Changed require-dev phpunit version limits to include ^4.0 2017-10-03 08:20:24 +03:00
Ismo Vuorinen
662acf0b48 Merge branch 'release/1.1.2' into develop 2017-09-15 19:24:49 +03:00
Ismo Vuorinen
37f35eeb26 CHANGELOG 2017-09-15 19:24:17 +03:00
Ismo Vuorinen
8fe5df77fb PHP5.6 composer install takes a long time... 2017-09-15 18:35:46 +03:00
Ismo Vuorinen
6140c7b999 Testing settings for travis-ci build config 2017-09-15 07:20:25 +03:00
Ismo Vuorinen
4f51fd8c51 Typo fixes, composer.lock and removal of dead code. Ready for v1.1.1. 2017-08-27 19:48:06 +03:00
Ismo Vuorinen
cf7d4d37de Release CHANGELOG and few fixes to README 2017-08-27 19:20:53 +03:00
Ismo Vuorinen
8aa4639b04 New Gozer tests, exposed methods for public usage (mainly for testing) 2017-08-27 19:04:42 +03:00
Ismo Vuorinen
3e9d7e8b06 PHP Code Sniffer fixes 2017-02-27 13:32:13 +02:00
Ismo Vuorinen
f14a1d8769 Gozer: Refactoring and tests 2017-02-14 13:47:33 +02:00
Ismo Vuorinen
5fe7412588 Dropping 5.6 from travis for now. Will investigate later. 2017-02-10 11:53:36 +02:00
Ismo Vuorinen
bbd501c2d6 Travis.yml cache settings to speed up our testing 2017-02-10 10:25:46 +02:00
Ismo Vuorinen
0509cbb2fb Typo in autoload-dev class mapping, removed Orchestra\Testbench 2017-02-10 10:12:28 +02:00
Ismo Vuorinen
f146683ae4 Mirroring Orhestra\Testbench travis config 2017-02-10 10:03:17 +02:00
Ismo Vuorinen
5ca3d391ad Another attempt to make travis find our classes 2017-02-10 10:01:29 +02:00
Ismo Vuorinen
8e49c144fd Autoloader addition, Orchestra\Testbench could not be found 2017-02-10 09:55:39 +02:00
Ismo Vuorinen
bb18cdd30f Setup error cleaning 2017-02-10 09:51:42 +02:00
Ismo Vuorinen
ab0a5a8d9d Testing Orchestra/TestBench workflow 2017-02-10 09:48:40 +02:00
Ismo Vuorinen
3d236cb55e Just get to the green already 2017-02-08 14:51:47 +02:00
Ismo Vuorinen
1dc771dfaa Moving from Laravel TestCase to \PHPUnit_Framework_TestCase 2017-02-08 14:49:53 +02:00
Ismo Vuorinen
239f5d718c phpunit.xml 2017-02-08 14:46:37 +02:00
Ismo Vuorinen
03405ded71 Add base tests to get something out 2017-02-08 14:43:20 +02:00
Ismo Vuorinen
0e0c094071 Documentation, fixes and better messages 2017-02-08 14:27:00 +02:00
Ismo Vuorinen
313dfec8d8 New command: superhelio:gozer, the Destroyer 2017-02-08 14:04:52 +02:00
Ismo Vuorinen
8c9e0ff85a Set better description to superhelio:reload 2017-02-08 14:04:13 +02:00
Ismo Vuorinen
4cd5eb29f4 TravisCI config 2017-02-08 10:29:36 +02:00
Ismo Vuorinen
a470911429 Merge branch 'release/1.0.0' into develop 2017-02-08 10:25:02 +02:00
Ismo Vuorinen
ee3fefbe63 Changelog 2017-02-08 10:22:02 +02:00
Ismo Vuorinen
be99c75812 Fixed Scrutinizer reported issue 2017-02-08 10:20:33 +02:00
Ismo Vuorinen
671bb0300b Updated changelog 2017-02-07 17:47:29 +02:00
Ismo Vuorinen
20fd92412e New changelog, testing github_changelog_generator out 2017-02-07 17:45:41 +02:00
Ismo Vuorinen
fffc0ff9ca Renamed LICENSE 2017-02-07 17:45:00 +02:00
Ismo Vuorinen
25840e0c5c Merge branch 'release/0.0.1' into develop 2017-02-07 17:24:32 +02:00
17 changed files with 4108 additions and 43 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
vendor

20
.travis.yml Normal file
View File

@@ -0,0 +1,20 @@
language: php
php:
- 7.0
- 7.1
- nightly
matrix:
allow_failures:
- php: nightly
fast_finish: true
cache:
directories:
- $HOME/.composer/cache/files
before_script:
- phpenv global "$TRAVIS_PHP_VERSION"
- composer config extra.platform.php $TRAVIS_PHP_VERSION
install:
- flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress"
- travis_wait 30 composer install $flags
script:
- ./vendor/bin/phpunit -c phpunit.xml

View File

@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## 0.0.1 - 2017-02-07 ## [1.2.0](https://github.com/superhelio/commands/tree/1.2.0) (2017-10-19)
### Added - Bumped PHP version requirement to >=7.0, PHP5.6 was taking really long time to resolve
- Included composer.lock, which is generated with PHP v7.0.23
## [1.1.2](https://github.com/superhelio/commands/tree/1.1.2) (2017-09-15)
- Removed composer.lock, only to enable correct CI builds
- Reworked travis-ci.org configuration, builds should now go green
## [1.1.1](https://github.com/superhelio/commands/tree/1.1.1) (2017-08-27)
- Typo fixes
- Removal of dead/unnecessary code
- Added composer.lock for faster builds
## [1.1.0](https://github.com/superhelio/commands/tree/1.1.0) (2017-08-27)
- New command: `superhelio:gozer` with tests
## [1.0.0](https://github.com/superhelio/commands/tree/1.0.0) (2017-02-08)
- Fixed Scrutinizer reported issue
- Renamed LICENSE
- Tested `github_changelog_generator`, but did not like it
## [0.0.1](https://github.com/superhelio/commands/tree/0.0.1) (2017-02-07)
- `superhelio:reload` - `superhelio:reload`

View File

View File

@@ -10,6 +10,8 @@
This is a collection of Laravel Artisan commands created to help everyone This is a collection of Laravel Artisan commands created to help everyone
in their development work. We try to keep these as useful as possible. in their development work. We try to keep these as useful as possible.
This package requires PHP 7.0 or later. `composer.lock` has been generated with PHP v7.0.23.
## Install ## Install
### Step 1: Install Through Composer ### Step 1: Install Through Composer
@@ -33,6 +35,9 @@ public function register()
## Usage ## Usage
- *superhelio:gozer*
- Force delete database tables that have your table prefix
- `php artisan superhelio:gozer`
- *superhelio:reload* - *superhelio:reload*
- Reset database, migrate and seed - Reset database, migrate and seed
- `php artisan superhelio:reload` - `php artisan superhelio:reload`
@@ -47,10 +52,6 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
$ composer test $ composer test
``` ```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security ## Security
If you discover any security related issues, please contact [SuperHelio](link-author). If you discover any security related issues, please contact [SuperHelio](link-author).
@@ -77,4 +78,5 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
[link-code-quality]: https://scrutinizer-ci.com/g/superhelio/commands [link-code-quality]: https://scrutinizer-ci.com/g/superhelio/commands
[link-downloads]: https://packagist.org/packages/superhelio/commands [link-downloads]: https://packagist.org/packages/superhelio/commands
[link-author]: https://github.com/superhelio [link-author]: https://github.com/superhelio
[link-contributors]: ../../contributors [link-contributors]: https://github.com/superhelio/commands/graphs/contributors
[link-dbal]: https://packagist.org/packages/doctrine/dbal

View File

@@ -1,6 +1,6 @@
{ {
"name": "superhelio/commands", "name": "superhelio/commands",
"description": "Laravel Commands", "description": "This is a collection of Laravel Artisan commands created to help everyone in their development work.",
"keywords": [ "keywords": [
"laravel", "laravel",
"superhelio", "superhelio",
@@ -17,11 +17,13 @@
} }
], ],
"require": { "require": {
"php" : ">=5.5.0", "php" : ">=7.0",
"illuminate/support": "~5.2" "illuminate/support": "^5.3|^5.4|^5.5",
"doctrine/dbal": "^2.5|^2.6"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit" : "4.*" "phpunit/phpunit" : "^5.0",
"orchestra/testbench": "~3.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@@ -30,7 +32,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Superhelio\\Commands\\Test\\": "tests" "Superhelio\\Commands\\Tests\\": "tests"
} }
}, },
"scripts": { "scripts": {
@@ -39,6 +41,11 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Superhelio\\Commands\\ServiceProvider"
]
} }
} }
} }

3489
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

27
phpunit.xml Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Superhelio\Commands Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
</php>
<filter>
<whitelist addUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>

194
src/Commands/Gozer.php Normal file
View File

@@ -0,0 +1,194 @@
<?php
namespace Superhelio\Commands\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class Gozer extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'superhelio:gozer';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Force delete database tables that have your table prefix';
/**
* @var string Database table prefix
*/
private $dbPrefix = '';
/**
* Execute the console command.
*
* @return bool
*/
public function handle()
{
if (!class_exists('\\Doctrine\\DBAL\\Schema\\Schema')) {
$this->error('You are missing doctrine/dbal, you should add it to your project:');
$this->info('composer require doctrine/dbal');
return false;
}
$this->info('
________
/ _____/ ____________ ___________
/ \ ___ / _ \___ // __ \_ __ \
\ \_\ ( <_> ) /\ ___/| | \/
\______ /\____/_____ \\___ >__|
\/ \/ \/
');
$this->setDatabasePrefix($this->getDatabasePrefix());
$confirmationQuestion = 'Delete all of your database tables?';
if (!empty($this->dbPrefix)) {
$confirmationQuestion = sprintf(
'Delete your tables that begin with %s*',
$this->dbPrefix
);
}
if ($this->confirm($confirmationQuestion)) {
$connection = $this->getConnection();
$tables = $this->getTables($connection);
/**
* Reject tables that do not have specified table prefix.
* We would not want to destroy other tables that might
* be in the same database, in "homestead" for example.
*
* @var \Illuminate\Support\Collection $tables
*/
$tables = $this->getFilteredTables($tables);
/**
* Check that we got at least one table, bail out if not
*/
if ($tables->count() < 1) {
$this->info('There are no tables, only Zuul.');
return true;
}
/**
* Bid your farewells to these tables.
* Last look and confirmation.
*/
$this->info(sprintf(
"Tables found:\n - %s",
implode(",\n - ", $tables->toArray())
));
$this->line('');
/**
* Last confirmation before dropping tables
*/
if ($this->confirm('Really delete those tables?')) {
/** Fancy pants progress bar to see your tables get destroyed */
$bar = $this->output->createProgressBar($tables->count());
Schema::disableForeignKeyConstraints();
$tables->each(function ($table) use ($bar, $connection) {
/** Drop the table */
$connection->dropTable($table);
/** Advance our progress bar */
$bar->advance();
});
Schema::enableForeignKeyConstraints();
/** Progress bar is now finished */
$bar->finish();
}
$this->line('');
$this->line('');
}
$this->info('Done.');
return true;
}
/**
* @return bool|\Doctrine\DBAL\Schema\AbstractSchemaManager
*/
public function getConnection()
{
try {
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $connection */
$connection = app('db')->connection()->getDoctrineSchemaManager();
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $connection;
}
/**
* @param \Doctrine\DBAL\Schema\AbstractSchemaManager $connection
*
* @return array|bool
*/
public function getTables(\Doctrine\DBAL\Schema\AbstractSchemaManager $connection)
{
try {
/** @var array $tables */
$tables = $connection->listTableNames();
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $tables;
}
public function getDatabasePrefix()
{
return trim(DB::getTablePrefix());
}
/**
* This is mainly for testing purposes
*
* @param string $prefix
*/
public function setDatabasePrefix($prefix = '')
{
$this->dbPrefix = $prefix;
}
/**
* @param array $tables
*
* @return \Illuminate\Support\Collection
*/
public function getFilteredTables($tables = [])
{
$prefix = $this->dbPrefix;
return collect($tables)->reject(function ($table) use ($prefix) {
return !starts_with($table, $prefix);
});
}
}

View File

@@ -11,24 +11,16 @@ class Reload extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'superhelio:reload'; protected $signature = 'superhelio:reload
{--automate=false : Should run without questions?}
{--loud=true : Should output reset and migrate outputs?}';
/** /**
* The console command description. * The console command description.
* *
* @var string * @var string
*/ */
protected $description = 'Delete database tables, migrate and run seeds'; protected $description = 'Rollback migrations, migrate and run seeds';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/** /**
* Execute the console command. * Execute the console command.
@@ -37,24 +29,51 @@ class Reload extends Command
*/ */
public function handle() public function handle()
{ {
if ($this->confirm('Rollback all your database tables, recreate them and seed?')) { $automated = $this->automate();
$this->call(
'migrate:reset', if ($automated && $this->confirm('Rollback all your database tables, recreate them and seed?')) {
[ return $this->runReload();
'--no-interaction' => true, }
'--env' => 'development', if (!$automated) {
'--verbose' => 3 return $this->runReload();
]
);
$this->call(
'migrate',
[
'--seed' => true,
'--no-interaction' => true,
'--env' => 'development',
'--verbose' => 3
]
);
} }
} }
public function automate()
{
$automate = $this->option('automate');
return !($automate === '1' || $automate === 1 || $automate === 'yes' || $automate === 'true');
}
public function outputVerbosity()
{
$output = $this->option('loud');
return ($output === '1' || $output === 1 || $output == 'yes' || $output == 'true');
}
public function runReload()
{
$verbose = ($this->outputVerbosity() ? 3 : 0);
$this->call(
'migrate:reset',
[
'--no-interaction' => true,
'--env' => 'development',
'--verbose' => $verbose
]
);
$this->call(
'migrate',
[
'--seed' => true,
'--no-interaction' => true,
'--env' => 'development',
'--verbose' => $verbose
]
);
return true;
}
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace Superhelio\Commands; namespace Superhelio\Commands;
class Facade extends \Illuminate\Support\Facades\Facade class Facade extends \Illuminate\Support\Facades\Facade

View File

@@ -30,6 +30,7 @@ class ServiceProvider extends BaseServiceProvider
public function register() public function register()
{ {
$this->registerReloader(); $this->registerReloader();
$this->registerGozer();
} }
private function registerReloader() private function registerReloader()
@@ -39,4 +40,12 @@ class ServiceProvider extends BaseServiceProvider
}); });
$this->commands('command.superhelio.reload'); $this->commands('command.superhelio.reload');
} }
private function registerGozer()
{
$this->app->singleton('command.superhelio.gozer', function ($app) {
return $app['Superhelio\Commands\Commands\Gozer'];
});
$this->commands('command.superhelio.gozer');
}
} }

132
tests/GozerTest.php Normal file
View File

@@ -0,0 +1,132 @@
<?php
namespace Superhelio\Commands;
use ReflectionClass;
use Superhelio\Commands\Commands\Gozer;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
class GozerTest extends \Orchestra\Testbench\TestCase
{
/**
* Setup the test environment.
*/
public function setUp()
{
parent::setUp();
$this->artisan('migrate', ['--database' => 'testbench']);
}
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
*
* @return void
*/
protected function getEnvironmentSetUp($app)
{
// Setup default database to use sqlite :memory:
$app['config']->set('database.default', 'testbench');
$app['config']->set('database.connections.testbench', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => 'gozerTest__',
]);
}
/**
* Get package providers.
* At a minimum this is the package being tested, but also
* would include packages upon which our package depends.
* In a normal app environment these would be added to
* the 'providers' array in the config/app.php file.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
'\Superhelio\Commands\Tests\Stubs\ServiceProvider',
'\Superhelio\Commands\ServiceProvider'
];
}
public function test_database_is_there_and_functions()
{
DB::table('users')->insert([
'name' => 'User name',
'email' => 'hello@gozer.dev',
'password' => bcrypt('123')
]);
$users = DB::table('users')->where('id', '=', 1)->first();
$this->assertEquals('hello@gozer.dev', $users->email);
$this->assertEquals('User name', $users->name);
$this->assertTrue(Hash::check('123', $users->password));
}
public function test_dbal_is_installed()
{
$this->assertTrue(class_exists('\\Doctrine\\DBAL\\Schema\\Schema'));
}
public function test_gozer_is_installed()
{
$this->assertTrue(class_exists('\\Superhelio\\Commands\\Commands\\Gozer'));
}
public function test_gozer_has_required_methods_and_properties()
{
$gozer = new ReflectionClass('\\Superhelio\\Commands\\Commands\\Gozer');
$this->assertTrue($gozer->hasMethod('handle'));
$this->assertTrue($gozer->hasProperty('signature'));
$this->assertTrue($gozer->hasProperty('description'));
$this->assertTrue($gozer->hasProperty('dbPrefix'));
}
public function test_gozer_finds_database_prefix()
{
$gozer = new Gozer();
$this->assertEquals('gozerTest__', $gozer->getDatabasePrefix());
}
public function test_gozer_finds_users_table()
{
$gozer = new Gozer();
$connection = $gozer->getConnection();
$tables = $gozer->getTables($connection);
$this->assertTrue(\in_array('gozerTest__users', $tables, false));
$gozer->setDatabasePrefix('gozerTest__');
$filteredTables = $gozer->getFilteredTables($tables);
$this->assertTrue(is_a($filteredTables, \Illuminate\Support\Collection::class));
$this->assertTrue(\in_array('gozerTest__users', $filteredTables->toArray(), false));
}
public function test_gozer_table_filtering_works()
{
$gozer = new Gozer();
$tables = array(
'gozerTest__users',
'gozerTest__migrations',
'this_should_be_filtered',
'filter_me_too'
);
$gozer->setDatabasePrefix('gozerTest__');
$filtered = $gozer->getFilteredTables($tables);
$array = $filtered->toArray();
$this->assertFalse(\in_array('this_should_be_filtered', $array, false));
$this->assertFalse(\in_array('filter_me_too', $array, false));
$this->assertTrue(\in_array('gozerTest__users', $array, false));
$this->assertTrue(\in_array('gozerTest__migrations', $array, false));
}
}

24
tests/PackageTest.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace Superhelio\Commands;
use ReflectionClass;
class PackageTest extends \Orchestra\Testbench\TestCase
{
public function test_facade()
{
$facade = new ReflectionClass(Facade::class);
$this->assertTrue($facade->hasMethod('getFacadeAccessor'));
$this->assertTrue($facade->getMethod('getFacadeAccessor')->isProtected());
$this->assertTrue($facade->getMethod('getFacadeAccessor')->isStatic());
}
public function test_service_provider()
{
$sp = new ReflectionClass(\Superhelio\Commands\ServiceProvider::class);
$this->assertTrue($sp->hasMethod('register'));
$this->assertTrue($sp->hasMethod('registerReloader'));
$this->assertTrue($sp->hasMethod('registerGozer'));
}
}

75
tests/ReloadTest.php Normal file
View File

@@ -0,0 +1,75 @@
<?php
namespace Superhelio\Commands;
use ReflectionClass;
use Superhelio\Commands\Commands\Reload;
class ReloadTest extends \Orchestra\Testbench\TestCase
{
/**
* Setup the test environment.
*/
public function setUp()
{
parent::setUp();
$this->artisan('migrate', ['--database' => 'testbench']);
}
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
*
* @return void
*/
protected function getEnvironmentSetUp($app)
{
// Setup default database to use sqlite :memory:
$app['config']->set('database.default', 'testbench');
$app['config']->set('database.connections.testbench', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => 'reloadTest__',
]);
}
/**
* Get package providers.
* At a minimum this is the package being tested, but also
* would include packages upon which our package depends.
* In a normal app environment these would be added to
* the 'providers' array in the config/app.php file.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
'\Superhelio\Commands\Tests\Stubs\ServiceProvider',
'\Superhelio\Commands\ServiceProvider'
];
}
public function test_reload_exists()
{
$this->assertTrue(class_exists(Reload::class));
$reload = new Reload();
$this->assertInstanceOf(Reload::class, $reload);
}
public function test_reload_has_required_methods_and_properties()
{
$reload = new Reload();
$this->assertTrue(method_exists($reload, 'handle'), 'handle');
$this->assertTrue(method_exists($reload, 'runReload'), 'runReload');
$this->assertTrue(method_exists($reload, 'automate'), 'automate');
$reload = new ReflectionClass(Reload::class);
$this->assertTrue($reload->hasProperty('signature'), 'signature');
$this->assertTrue($reload->hasProperty('description'), 'description');
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Superhelio\Commands\Tests\Stubs;
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function boot()
{
$this->loadMigrationsFrom(\dirname(__DIR__) . '/migrations');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}