Skip to content

Commit

Permalink
Add Fluent helpers (using config option) (#404)
Browse files Browse the repository at this point in the history
* add fluent option to Generator

* add fluent to helper output

* add fluent option to config

* typo
  • Loading branch information
eidng8 authored and barryvdh committed Nov 15, 2016
1 parent 5fad258 commit 105f14a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/ide-helper.php
Expand Up @@ -14,6 +14,17 @@
'filename' => '_ide_helper',
'format' => 'php',

/*
|--------------------------------------------------------------------------
| Fluent helpers
|--------------------------------------------------------------------------
|
| Set to true to generate commonly used Fluent methods
|
*/

'include_fluent' => false,

/*
|--------------------------------------------------------------------------
| Helper files to include
Expand Down
27 changes: 27 additions & 0 deletions resources/views/helper.php
Expand Up @@ -37,3 +37,30 @@ public static function <?= $method->getName() ?>(<?= $method->getParamsWithDefau
}

<?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 change: 1 addition & 0 deletions src/Generator.php
Expand Up @@ -84,6 +84,7 @@ public function generatePhpHelper()
->with('namespaces', $this->getNamespaces())
->with('helpers', $this->helpers)
->with('version', $app->version())
->with('include_fluent', $this->config->get('ide-helper.include_fluent', false))
->render();
}

Expand Down

0 comments on commit 105f14a

Please sign in to comment.