Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from point-red/develop
Add new HR Modules for KPI
- Loading branch information
Showing
117 changed files
with
3,919 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class GenerateScaffoldingCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'scaffolding:generate {module} {name} {--submodule=}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Generate scaffolding'; | ||
|
||
protected $name; | ||
|
||
protected $module; | ||
|
||
protected $submodule; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->module = $this->argument('module').DIRECTORY_SEPARATOR; | ||
$this->name = $this->argument('name'); | ||
|
||
if ($this->option('submodule')) { | ||
$this->submodule = $this->option('submodule').DIRECTORY_SEPARATOR; | ||
} | ||
|
||
Artisan::call('make:model', [ | ||
'name' => 'Model\\'.$this->module.$this->submodule.$this->name, | ||
'-m' => true, | ||
]); | ||
|
||
$this->line('created '.$this->name.' model'); | ||
|
||
Artisan::call('make:controller', [ | ||
'name' => 'Api\\'.$this->module.$this->submodule.$this->name.'Controller', | ||
'-r' => true, | ||
]); | ||
|
||
$this->line('created '.$this->name.' controller'); | ||
|
||
Artisan::call('make:resource', [ | ||
'name' => $this->module.$this->submodule.$this->name.'\\'.$this->name.'Resource', | ||
]); | ||
|
||
$this->line('created '.$this->name.' resource'); | ||
|
||
Artisan::call('make:resource', [ | ||
'name' => $this->module.$this->submodule.$this->name.'\\'.$this->name.'Collection', | ||
'--collection' => true, | ||
]); | ||
|
||
$this->line('created '.$this->name.' collection'); | ||
|
||
Artisan::call('make:request', [ | ||
'name' => $this->module.$this->submodule.$this->name.'\\Store'.$this->name.'Request', | ||
]); | ||
|
||
$this->line('created '.$this->name.' store request'); | ||
|
||
Artisan::call('make:request', [ | ||
'name' => $this->module.$this->submodule.$this->name.'\\Update'.$this->name.'Request', | ||
]); | ||
|
||
$this->line('created '.$this->name.' update request'); | ||
|
||
Artisan::call('make:factory', [ | ||
'name' => $this->name.'Factory', | ||
]); | ||
|
||
$this->line('created '.$this->name.' factory'); | ||
|
||
Artisan::call('make:test', [ | ||
'name' => $this->module.$this->submodule.$this->name.'Test', | ||
]); | ||
|
||
$this->line('created '.$this->name.' test class'); | ||
|
||
Artisan::call('make:test', [ | ||
'name' => $this->module.$this->submodule.$this->name.'ValidationTest', | ||
]); | ||
|
||
$this->line('created '.$this->name.' validation test class'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class SeedDummyDatabase extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'tenant:seed-dummy {tenant_subdomain}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Seed dummy data for tenant'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
Artisan::call('db:seed', [ | ||
'--database' => 'mysql', | ||
'--class' => 'DummyDatabaseSeeder', | ||
]); | ||
|
||
$tenantSubdomain = $this->argument('tenant_subdomain'); | ||
|
||
config()->set('database.connections.tenant.database', $tenantSubdomain); | ||
DB::connection('tenant')->reconnect(); | ||
|
||
Artisan::call('db:seed', [ | ||
'--database' => 'tenant', | ||
'--class' => 'DummyTenantDatabaseSeeder', | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
app/Http/Controllers/Api/HumanResource/Kpi/KpiCategoryController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\HumanResource\Kpi; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use App\Model\HumanResource\Kpi\KpiCategory; | ||
use App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryResource; | ||
use App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryCollection; | ||
use App\Http\Requests\HumanResource\Kpi\KpiCategory\StoreKpiCategoryRequest; | ||
use App\Http\Requests\HumanResource\Kpi\KpiCategory\UpdateKpiCategoryRequest; | ||
|
||
class KpiCategoryController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryCollection | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$limit = $request->input('limit') ?? 0; | ||
|
||
return new KpiCategoryCollection(KpiCategory::paginate($limit)); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \App\Http\Requests\HumanResource\Kpi\KpiCategory\StoreKpiCategoryRequest $request | ||
* | ||
* @return \App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryResource | ||
*/ | ||
public function store(StoreKpiCategoryRequest $request) | ||
{ | ||
$kpiCategory = new KpiCategory(); | ||
$kpiCategory->name = $request->input('name'); | ||
$kpiCategory->date = $request->input('date'); | ||
$kpiCategory->person_id = $request->input('person_id'); | ||
$kpiCategory->save(); | ||
|
||
return new KpiCategoryResource($kpiCategory); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* | ||
* @return \App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryResource | ||
*/ | ||
public function show($id) | ||
{ | ||
return new KpiCategoryResource(KpiCategory::findOrFail($id)); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \App\Http\Requests\HumanResource\Kpi\KpiCategory\UpdateKpiCategoryRequest $request | ||
* @param int $id | ||
* | ||
* @return \App\Http\Resources\HumanResource\Kpi\KpiCategory\KpiCategoryResource | ||
*/ | ||
public function update(UpdateKpiCategoryRequest $request, $id) | ||
{ | ||
$kpiCategory = KpiCategory::findOrFail($id); | ||
$kpiCategory->name = $request->input('name'); | ||
$kpiCategory->date = $request->input('date'); | ||
$kpiCategory->person_id = $request->input('person_id'); | ||
$kpiCategory->save(); | ||
|
||
return new KpiCategoryResource($kpiCategory); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy($id) | ||
{ | ||
KpiCategory::findOrFail($id)->delete(); | ||
|
||
return response(null, 204); | ||
} | ||
} |
Oops, something went wrong.