diff --git a/config/ide-helper.php b/config/ide-helper.php index 24a6e28b4..5350f3af0 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -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 diff --git a/resources/views/helper.php b/resources/views/helper.php index 4d0888f58..7b39b5214 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -37,3 +37,30 @@ public static function getName() ?>(getParamsWithDefau } + + + +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 {} +} + diff --git a/src/Generator.php b/src/Generator.php index 693f68297..d9b80688b 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -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(); }