Skip to content

Commit

Permalink
Refactor/vic laravel template (#19)
Browse files Browse the repository at this point in the history
* feat(repository): add updated_at to default filters

* refactor(resource): generate base request

* feat(seed): add environment verification

* refactor(request): change store prepareForValidation from replace to merge

* refactor(request): change update prepareForValidation from replace to merge

* 1.2.9: app version
  • Loading branch information
txsoura authored Oct 17, 2021
1 parent 33256b1 commit 78c1ae1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class <%= namePascal %>StoreRequest extends CoreRequest
*/
protected function prepareForValidation()
{
return $this->replace([
return $this->merge([
//
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class <%= namePascal %>UpdateRequest extends CoreRequest
*/
protected function prepareForValidation()
{
return $this->replace([
return $this->merge([
//
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class <%= namePascal %>Resource extends JsonResource
*/
public function toArray($request)
{
return [
//
];
return parent::toArray($request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class <%= namePascal %>Repository extends CoreRepository
* Allowed model columns to use in sort
* @var array
*/
protected $allow_order = array('created_at');
protected $allow_order = array('created_at','updated_at');

/**
* Allowed model columns to use in query search
Expand All @@ -35,7 +35,7 @@ class <%= namePascal %>Repository extends CoreRepository
* Allowed model columns to use in filter by date
* @var array
*/
protected $allow_between_dates = array('created_at');
protected $allow_between_dates = array('created_at','updated_at');

/**
* Allowed model columns to use in filter by value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Database\Seeders;

use App\Models\<%= namePascal %>;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\App;

class <%= namePascal %>Seeder extends Seeder
{
Expand All @@ -14,6 +15,8 @@ class <%= namePascal %>Seeder extends Seeder
*/
public function run()
{
<%= namePascal %>::factory(1)->create();
if (App::environment('local')) {
<%= namePascal %>::factory(1)->create();
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-secjs",
"version": "1.2.8",
"version": "1.2.9",
"description": "🧬 Generator for any NodeJS Project or Framework",
"main": "app/index.js",
"scripts": {
Expand Down

0 comments on commit 78c1ae1

Please sign in to comment.