diff --git a/app/Console/Commands/MakeModule.php b/app/Console/Commands/MakeModule.php
index 706cc0c36fa4..688c04b53d31 100644
--- a/app/Console/Commands/MakeModule.php
+++ b/app/Console/Commands/MakeModule.php
@@ -12,7 +12,7 @@ class MakeModule extends Command
*
* @var string
*/
- protected $signature = 'ninja:make-module {name} {fields?}';
+ protected $signature = 'ninja:make-module {name} {fields?} {--migrate=}';
/**
* The console command description.
@@ -40,6 +40,7 @@ class MakeModule extends Command
{
$name = $this->argument('name');
$fields = $this->argument('fields');
+ $migrate = $this->option('migrate');
$lower = strtolower($name);
// convert 'name:string,description:text' to 'name,description'
@@ -53,7 +54,6 @@ class MakeModule extends Command
Artisan::call('module:make', ['name' => [$name]]);
Artisan::call('module:make-migration', ['name' => "create_{$lower}_table", '--fields' => $fields, 'module' => $name]);
- Artisan::call('module:migrate', ['module' => $name]);
Artisan::call('module:make-model', ['model' => $name, 'module' => $name, '--fillable' => $fillable]);
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'views', '--fields' => $fields, '--filename' => 'edit.blade']);
@@ -68,6 +68,12 @@ class MakeModule extends Command
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'api-controller']);
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'transformer', '--fields' => $fields]);
+ if ($migrate) {
+ Artisan::call('module:migrate', ['module' => $name]);
+ } else {
+ $this->info("Use the following command to run the migrations:\nphp artisan module:migrate $name");
+ }
+
Artisan::call('module:dump');
}
@@ -79,4 +85,11 @@ class MakeModule extends Command
];
}
+ protected function getOptions()
+ {
+ return array(
+ array('migrate', null, InputOption::VALUE_OPTIONAL, 'The model attributes.', null),
+ );
+ }
+
}
diff --git a/app/Console/Commands/stubs/repository.stub b/app/Console/Commands/stubs/repository.stub
index a4b358087c99..208172251ecf 100644
--- a/app/Console/Commands/stubs/repository.stub
+++ b/app/Console/Commands/stubs/repository.stub
@@ -37,19 +37,14 @@ class $STUDLY_NAME$Repository extends BaseRepository
$this->applyFilters($query, '$LOWER_NAME$');
- /*
- if ($filter) {
- $query->where(function ($query) use ($filter) {
- $query->where('clients.name', 'like', '%'.$filter.'%')
- ->orWhere('contacts.first_name', 'like', '%'.$filter.'%')
- ->orWhere('contacts.last_name', 'like', '%'.$filter.'%')
- ->orWhere('contacts.email', 'like', '%'.$filter.'%');
- });
- }
-
if ($userId) {
$query->where('clients.user_id', '=', $userId);
}
+
+ /*
+ if ($filter) {
+ $query->where();
+ }
*/
return $query;
@@ -59,12 +54,6 @@ class $STUDLY_NAME$Repository extends BaseRepository
{
$entity = $$LOWER_NAME$ ?: $STUDLY_NAME$::createNew();
- /*
- if ($entity->is_deleted) {
- return $entity;
- }
- */
-
$entity->fill($data);
$entity->save();
diff --git a/resources/views/partials/navigation_option.blade.php b/resources/views/partials/navigation_option.blade.php
index 5b8c20a75dbc..838a1eeb7a7f 100644
--- a/resources/views/partials/navigation_option.blade.php
+++ b/resources/views/partials/navigation_option.blade.php
@@ -7,7 +7,7 @@
- @elseif (Auth::user()->can('create', substr($option, 0, -1)))
+ @elseif (Auth::user()->can('create', $option) || Auth::user()->can('create', substr($option, 0, -1)))