This is where your description should go. Take a look at contributing.md to see a to do list.
Via Composer
$ composer require oguzcandemircan/laravel-stub-generator
return [
'source_path' => storage_path('stubs/source'), // stubs source path
'target_path' => storage_path('stubs/target'), // stubs target path
];
Stub file:
//storage/stubs/source/model.stub
namespace {{namespace}};
use Illuminate\Database\Eloquent\Model;
class {{modelName}} extends Model
{
protected $fillable = [{{fillable}}];
}
Generate:
LaravelStubGenerator::source('model')->params([
'{{modelName}}' => 'UserModel',
'{{namespace}}' => 'App\Models',
'{{fillable}}' => "'name', 'email', 'age'",
])->generate();
Save:
LaravelStubGenerator::source('model')->params([
'{{modelName}}' => 'UserModel',
'{{namespace}}' => 'App\Models',
'{{fillable}}' => "'name', 'email', 'age'",
])->save('UserModel.php');
// force save
->save('UserModel.php', true);
Output:
//storage/stubs/target/UserModel.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserModel extends Model
{
protected $fillable = ['name', 'email', 'age'];
}
Download:
LaravelStubGenerator::source('model')->params([
'{{modelName}}' => 'UserModel',
'{{namespace}}' => 'App\Models',
'{{fillable}}' => "'name', 'email', 'age'",
])->download('UserModel.php');
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
license. Please see the license file for more information.