Add Fluent helpers (using config option) (#404)

* add fluent option to Generator

* add fluent to helper output

* add fluent option to config

* typo
This commit is contained in:
Jackey Cheung
2016-11-15 09:21:23 +01:00
committed by Barry vd. Heuvel
parent 5fad258f5d
commit 105f14a50d
3 changed files with 39 additions and 0 deletions
+11
View File
@@ -14,6 +14,17 @@ return array(
'filename' => '_ide_helper',
'format' => 'php',
/*
|--------------------------------------------------------------------------
| Fluent helpers
|--------------------------------------------------------------------------
|
| Set to true to generate commonly used Fluent methods
|
*/
'include_fluent' => false,
/*
|--------------------------------------------------------------------------
| Helper files to include
+27
View File
@@ -37,3 +37,30 @@ namespace <?= $namespace == '__root' ? '' : $namespace ?>{
}
<?php endforeach; ?>
<?php if($include_fluent): ?>
namespace Illuminate\Support {
/**
* Methods commonly used in migrations
*
* @method Fluent after(string $column) Add the after modifier
* @method Fluent charset(string $charset) Add the character set modifier
* @method Fluent collation(string $collation) Add the collation modifier
* @method Fluent comment(string $comment) Add comment
* @method Fluent default(mixed $value) Add the default modifier
* @method Fluent first() Select first row
* @method Fluent index(string $name = null) Add the in dex clause
* @method Fluent on(string $column) `on` of a foreign key
* @method Fluent onDelete(string $action) `on delete` of a foreign key
* @method Fluent onUpdate(string $action) `on update` of a foreign key
* @method Fluent primary() Add the primary key modifier
* @method Fluent references(string $table) `references` of a foreign key
* @method Fluent nullable() Add the nullable modifier
* @method Fluent unique(string $name = null) Add unique index clause
* @method Fluent unsigned() Add the unsigned modifier
* @method Fluent useCurrent() Add the default timestamp value
*/
class Fluent {}
}
<?php endif ?>
+1
View File
@@ -84,6 +84,7 @@ class Generator
->with('namespaces', $this->getNamespaces())
->with('helpers', $this->helpers)
->with('version', $app->version())
->with('include_fluent', $this->config->get('ide-helper.include_fluent', false))
->render();
}