Code Duplication    Length = 398-398 lines in 5 locations

app/Api/Controllers/Admin/Job/EmploymentStatusController.php 1 location

@@ 33-430 (lines=398) @@
30
/**
31
 * Class EmploymentStatusController.
32
 */
33
class EmploymentStatusController extends BaseController
34
{
35
    /**
36
     * @var EmploymentStatus
37
     */
38
    protected $employment_status;
39
40
    /**
41
     * @param EmploymentStatus $employment_status
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45
    public function __construct(EmploymentStatus $employment_status)
46
    {
47
        $this->employment_status = $employment_status;
48
    }
49
50
    /**
51
     * Delete the Admin - Employment Status.
52
     *
53
     * @SWG\Delete(
54
     *     path="/admin/job/employment-status/{employment_status}",
55
     *     description="This route provides the ability to delete an Employment Status.",
56
     *     tags={"Administration"},
57
     *     consumes={"application/json"},
58
     *     summary="Deletes an Employment Status.",
59
     *     @SWG\Response(response="200", description="Success",
60
     *         @SWG\Schema(
61
     *             title="data",
62
     *             type="object",
63
     *             required={"message", "status_code"},
64
     *             @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"),
65
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
66
     *         )
67
     *     ),
68
     *     @SWG\Response(response="400", description="Token not provided",
69
     *         @SWG\Schema(
70
     *             title="data",
71
     *             type="object",
72
     *             required={"message", "status_code", "debug"},
73
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
74
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
75
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
76
     *         )
77
     *     ),
78
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
79
     *         @SWG\Schema(
80
     *             title="data",
81
     *             type="object",
82
     *             required={"message", "status_code"},
83
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
84
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
85
     *         )
86
     *     ),
87
     *     @SWG\Parameter(
88
     *         name="employment_status",
89
     *         in="path",
90
     *         description="Employment status id to be deleted",
91
     *         required=true,
92
     *         type="integer",
93
     *         format="int64",
94
     *         default=1,
95
     *     ),
96
     *     @SWG\Parameter(
97
     *         name="Authorization",
98
     *         in="header",
99
     *         description="JWT Token",
100
     *         required=true,
101
     *         type="string",
102
     *         default="Bearer "
103
     *     ),
104
     * )
105
     *
106
     * @param EmploymentStatus        $employment_status
107
     * @param EmploymentStatusRequest $request
108
     *
109
     * @return \Dingo\Api\Http\Response
110
     *
111
     * @author Bertrand Kintanar <[email protected]>
112
     */
113
    public function destroy(EmploymentStatus $employment_status, EmploymentStatusRequest $request)
114
    {
115
        return $this->destroyModel($employment_status, $this->employment_status);
116
    }
117
118
    /**
119
     * Retrieves a paginate aware collection of Employment Statuses.
120
     *
121
     * @SWG\Get(
122
     *     path="/admin/job/employment-status",
123
     *     description="This route provides the ability to retrieve a paginate aware collection of Employment Statuses.",
124
     *     tags={"Administration"},
125
     *     consumes={"application/json"},
126
     *     summary="Retrieves a paginate aware collection of Employment Statuses.",
127
     *     @SWG\Response(response="200", description="Success",
128
     *         @SWG\Schema(
129
     *             title="data",
130
     *             type="object",
131
     *             required={"data", "table", "message", "status_code"},
132
     *             @SWG\Property(property="data", type="object",
133
     *                 @SWG\Property(property="total", type="integer", default=22),
134
     *                 @SWG\Property(property="per_page", type="integer", default=10),
135
     *                 @SWG\Property(property="current_page", type="integer", default=1),
136
     *                 @SWG\Property(property="last_page", type="integer", default=3),
137
     *                 @SWG\Property(property="next_page_url", type="string", default="https://api.hris.dev/api/admin/job/employment-status?page=2"),
138
     *                 @SWG\Property(property="prev_page_url", type="string", default="null"),
139
     *                 @SWG\Property(property="from", type="integer", default=1),
140
     *                 @SWG\Property(property="to", type="integer", default=10),
141
     *                 @SWG\Property(property="data", type="array",
142
     *                     @SWG\Items(ref="#/definitions/EmploymentStatus"),
143
     *                 ),
144
     *             ),
145
     *             @SWG\Property(property="table", type="object",
146
     *                 @SWG\Property(property="title", type="string", default="Employment Status"),
147
     *                 @SWG\Property(property="permission", type="string", default="admin.job.employment-status"),
148
     *                 @SWG\Property(property="headers", type="array",
149
     *                     @SWG\Items(title="Id", type="string", default="Id"),
150
     *                 ),
151
     *                 @SWG\Property(property="model", type="object",
152
     *                     @SWG\Property(property="singular", type="string", default="employment_status"),
153
     *                     @SWG\Property(property="plural", type="string", default="employment_statuses"),
154
     *                     @SWG\Property(property="dashed", type="string", default="employment-statuses"),
155
     *                 ),
156
     *                 @SWG\Property(property="data", type="array",
157
     *                     @SWG\Items(ref="#/definitions/EmploymentStatus"),
158
     *                 ),
159
     *             ),
160
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
161
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
162
     *         )
163
     *     ),
164
     *     @SWG\Parameter(
165
     *         name="page",
166
     *         in="query",
167
     *         description="Page number for pagination",
168
     *         required=true,
169
     *         type="string",
170
     *         default="1"
171
     *     ),
172
     *     @SWG\Parameter(
173
     *         name="Authorization",
174
     *         in="header",
175
     *         description="JWT Token",
176
     *         required=true,
177
     *         type="string",
178
     *         default="Bearer "
179
     *     ),
180
     * )
181
     *
182
     * @param EmploymentStatusRequest $request
183
     *
184
     * @return \Dingo\Api\Http\Response
185
     *
186
     * @author Bertrand Kintanar <[email protected]>
187
     */
188
    public function index(EmploymentStatusRequest $request)
189
    {
190
        $employment_statuses = $this->employment_status->paginate(ROWS_PER_PAGE);
191
192
        $data = ['data' => $employment_statuses, 'table' => $this->setupDataTable($employment_statuses)];
193
194
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
195
    }
196
197
    /**
198
     * Setup table for employment status.
199
     *
200
     * @param $employment_statuses
201
     *
202
     * @return array
203
     *
204
     * @author Bertrand Kintanar <[email protected]>
205
     */
206
    protected function setupDataTable($employment_statuses)
207
    {
208
        $table = [];
209
210
        $table['title'] = 'Employment Statuses';
211
        $table['permission'] = 'admin.job.employment-status';
212
        $table['headers'] = ['Id', 'Name'];
213
        $table['model'] = [
214
            'singular' => 'employment_status',
215
            'plural'   => 'employment_statuses',
216
            'dashed'   => 'employment-statuses',
217
        ];
218
        $table['items'] = $employment_statuses;
219
220
        return $table;
221
    }
222
223
    /**
224
     * Stores a single instance of Employment Status.
225
     *
226
     * @SWG\Post(
227
     *     path="/admin/job/employment-status",
228
     *     description="This route provides the ability to store a single instance of Employment Status.",
229
     *     tags={"Administration"},
230
     *     consumes={"application/json"},
231
     *     summary="Stores a single instance of Employment Status.",
232
     *     @SWG\Response(response="201", description="Success",
233
     *         @SWG\Schema(
234
     *             title="data",
235
     *             type="object",
236
     *             required={"employment_status", "message", "status_code"},
237
     *             @SWG\Property(property="employment_status", ref="#/definitions/EmploymentStatus"),
238
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
239
     *             @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"),
240
     *         )
241
     *     ),
242
     *     @SWG\Response(response="400", description="Token not provided",
243
     *         @SWG\Schema(
244
     *             title="data",
245
     *             type="object",
246
     *             required={"message", "status_code", "debug"},
247
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
248
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
249
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
250
     *         )
251
     *     ),
252
     *     @SWG\Response(response="422", description="Unable to add record to the database.",
253
     *         @SWG\Schema(
254
     *             title="data",
255
     *             type="object",
256
     *             required={"message", "status_code"},
257
     *             @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"),
258
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
259
     *         )
260
     *     ),
261
     *     @SWG\Parameter(
262
     *         name="employment_status",
263
     *         in="body",
264
     *         required=true,
265
     *         @SWG\Property(ref="#/definitions/EmploymentStatus")
266
     *     ),
267
     *     @SWG\Parameter(
268
     *         name="Authorization",
269
     *         in="header",
270
     *         description="JWT Token",
271
     *         required=true,
272
     *         type="string",
273
     *         default="Bearer "
274
     *     ),
275
     * )
276
     *
277
     * @param EmploymentStatusRequest $request
278
     *
279
     * @return \Dingo\Api\Http\Response
280
     *
281
     * @author Bertrand Kintanar <[email protected]>
282
     */
283
    public function store(EmploymentStatusRequest $request)
284
    {
285
        return $this->storeModel($request, $this->employment_status, 'employment_status');
286
    }
287
288
    /**
289
     * Retrieves a single instance of Employment Status.
290
     *
291
     * @SWG\Get(
292
     *     path="/admin/job/employment-status/{employment_status}",
293
     *     description="This route provides the ability to retrieve a single instance of Employment Status.",
294
     *     tags={"Administration"},
295
     *     consumes={"application/json"},
296
     *     summary="Retrieves a single instance of Employment Status.",
297
     *     @SWG\Response(response="200", description="Success",
298
     *         @SWG\Schema(
299
     *             title="data",
300
     *             type="object",
301
     *             required={"employment_status", "message", "status_code"},
302
     *             @SWG\Property(property="employment_status", ref="#/definitions/EmploymentStatus"),
303
     *             @SWG\Property(property="message", type="string", default="Record successfully retrieved.", description="Status message from server"),
304
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
305
     *         )
306
     *     ),
307
     *     @SWG\Response(response="400", description="Token not provided",
308
     *         @SWG\Schema(
309
     *             title="data",
310
     *             type="object",
311
     *             required={"message", "status_code", "debug"},
312
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
313
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
314
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
315
     *         )
316
     *     ),
317
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
318
     *         @SWG\Schema(
319
     *             title="data",
320
     *             type="object",
321
     *             required={"message", "status_code"},
322
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
323
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
324
     *         )
325
     *     ),
326
     *     @SWG\Parameter(
327
     *         name="employment_status",
328
     *         in="path",
329
     *         description="Employment status id to be retrieved.",
330
     *         required=true,
331
     *         type="integer",
332
     *         format="int64",
333
     *         default=1,
334
     *     ),
335
     *     @SWG\Parameter(
336
     *         name="Authorization",
337
     *         in="header",
338
     *         description="JWT Token",
339
     *         required=true,
340
     *         type="string",
341
     *         default="Bearer "
342
     *     ),
343
     * )
344
     *
345
     * @param EmploymentStatus $employment_status
346
     *
347
     * @return \Dingo\Api\Http\Response
348
     *
349
     * @author Bertrand Kintanar <[email protected]>
350
     */
351
    public function show(EmploymentStatus $employment_status)
352
    {
353
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, compact('employment_status'));
354
    }
355
356
    /**
357
     * Updates a single instance of Employment Status.
358
     *
359
     * @SWG\Patch(
360
     *     path="/admin/job/employment-status",
361
     *     description="This route provides the ability to update a single instance of Employment Status.",
362
     *     tags={"Administration"},
363
     *     consumes={"application/json"},
364
     *     summary="Updates a single instance of Employment Status",
365
     *     @SWG\Response(response="200", description="Success",
366
     *         @SWG\Schema(
367
     *             title="data",
368
     *             type="object",
369
     *             required={"message", "status_code"},
370
     *             @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"),
371
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
372
     *         )
373
     *     ),
374
     *     @SWG\Response(response="400", description="Token not provided",
375
     *         @SWG\Schema(
376
     *             title="data",
377
     *             type="object",
378
     *             required={"message", "status_code", "debug"},
379
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
380
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
381
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
382
     *         )
383
     *     ),
384
     *     @SWG\Response(response="404", description="Unable to retrieve record from database.",
385
     *         @SWG\Schema(
386
     *             title="data",
387
     *             type="object",
388
     *             required={"message", "status_code", "debug"},
389
     *             @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"),
390
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
391
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
392
     *         )
393
     *     ),
394
     *     @SWG\Response(response="422", description="Unable to update record.",
395
     *         @SWG\Schema(
396
     *             title="data",
397
     *             type="object",
398
     *             required={"message", "status_code"},
399
     *             @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"),
400
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
401
     *         )
402
     *     ),
403
     *     @SWG\Parameter(
404
     *         name="employment_status",
405
     *         in="body",
406
     *         required=true,
407
     *         description="employment status object that needs to be updated",
408
     *         @SWG\Property(ref="#/definitions/EmploymentStatus")
409
     *     ),
410
     *     @SWG\Parameter(
411
     *         name="Authorization",
412
     *         in="header",
413
     *         description="JWT Token",
414
     *         required=true,
415
     *         type="string",
416
     *         default="Bearer "
417
     *     ),
418
     * )
419
     *
420
     * @param EmploymentStatusRequest $request
421
     *
422
     * @return \Dingo\Api\Http\Response
423
     *
424
     * @author Bertrand Kintanar <[email protected]>
425
     */
426
    public function update(EmploymentStatusRequest $request)
427
    {
428
        return $this->updateModel($request, $this->employment_status, ['name', 'class']);
429
    }
430
}
431

app/Api/Controllers/Admin/Job/JobTitlesController.php 1 location

@@ 33-430 (lines=398) @@
30
/**
31
 * Class JobTitlesController.
32
 */
33
class JobTitlesController extends BaseController
34
{
35
    /**
36
     * @var JobTitle
37
     */
38
    protected $job_title;
39
40
    /**
41
     * @param JobTitle $job_title
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45
    public function __construct(JobTitle $job_title)
46
    {
47
        $this->job_title = $job_title;
48
    }
49
50
    /**
51
     * Deletes a single instance of Job Title.
52
     *
53
     * @SWG\Delete(
54
     *     path="/admin/job/titles/{job_title}",
55
     *     description="This route provides the ability to delete a Job Title.",
56
     *     tags={"Administration"},
57
     *     consumes={"application/json"},
58
     *     summary="Deletes a single instance of Employment Status.",
59
     *     @SWG\Response(response="200", description="Success",
60
     *         @SWG\Schema(
61
     *             title="data",
62
     *             type="object",
63
     *             required={"message", "status_code"},
64
     *             @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"),
65
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
66
     *         )
67
     *     ),
68
     *     @SWG\Response(response="400", description="Token not provided",
69
     *         @SWG\Schema(
70
     *             title="data",
71
     *             type="object",
72
     *             required={"message", "status_code", "debug"},
73
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
74
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
75
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
76
     *         )
77
     *     ),
78
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
79
     *         @SWG\Schema(
80
     *             title="data",
81
     *             type="object",
82
     *             required={"message", "status_code"},
83
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
84
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
85
     *         )
86
     *     ),
87
     *     @SWG\Parameter(
88
     *         name="job_title",
89
     *         in="path",
90
     *         description="Job title id to be deleted",
91
     *         required=true,
92
     *         type="integer",
93
     *         format="int64",
94
     *         default=1,
95
     *     ),
96
     *     @SWG\Parameter(
97
     *         name="Authorization",
98
     *         in="header",
99
     *         description="JWT Token",
100
     *         required=true,
101
     *         type="string",
102
     *         default="Bearer "
103
     *     ),
104
     * )
105
     *
106
     * @param JobTitle        $job_title
107
     * @param JobTitleRequest $request
108
     *
109
     * @return \Dingo\Api\Http\Response
110
     *
111
     * @author Bertrand Kintanar <[email protected]>
112
     */
113
    public function destroy(JobTitle $job_title, JobTitleRequest $request)
114
    {
115
        return $this->destroyModel($job_title, $this->job_title);
116
    }
117
118
    /**
119
     * Retrieves a paginate aware collection of Job Title.
120
     *
121
     * @SWG\Get(
122
     *     path="/admin/job/titles",
123
     *     description="This route provides the ability to retrieve a paginate aware collection of Job Titles.",
124
     *     tags={"Administration"},
125
     *     consumes={"application/json"},
126
     *     summary="Retrieves a paginate aware collection of Job Title.",
127
     *     @SWG\Response(response="200", description="Success",
128
     *         @SWG\Schema(
129
     *             title="data",
130
     *             type="object",
131
     *             required={"data", "table", "message", "status_code"},
132
     *             @SWG\Property(property="data", type="object",
133
     *                 @SWG\Property(property="total", type="integer", default=22),
134
     *                 @SWG\Property(property="per_page", type="integer", default=10),
135
     *                 @SWG\Property(property="current_page", type="integer", default=1),
136
     *                 @SWG\Property(property="last_page", type="integer", default=3),
137
     *                 @SWG\Property(property="next_page_url", type="string", default="https://api.hris.dev/api/admin/job/titles?page=2"),
138
     *                 @SWG\Property(property="prev_page_url", type="string", default="null"),
139
     *                 @SWG\Property(property="from", type="integer", default=1),
140
     *                 @SWG\Property(property="to", type="integer", default=10),
141
     *                 @SWG\Property(property="data", type="array",
142
     *                     @SWG\Items(ref="#/definitions/JobTitle"),
143
     *                 ),
144
     *             ),
145
     *             @SWG\Property(property="table", type="object",
146
     *                 @SWG\Property(property="title", type="string", default="Job Title"),
147
     *                 @SWG\Property(property="permission", type="string", default="admin.job.titles"),
148
     *                 @SWG\Property(property="headers", type="array",
149
     *                     @SWG\Items(title="Id", type="string", default="Id"),
150
     *                 ),
151
     *                 @SWG\Property(property="model", type="object",
152
     *                     @SWG\Property(property="singular", type="string", default="job_title"),
153
     *                     @SWG\Property(property="plural", type="string", default="job_titles"),
154
     *                     @SWG\Property(property="dashed", type="string", default="job-titles"),
155
     *                 ),
156
     *                 @SWG\Property(property="data", type="array",
157
     *                     @SWG\Items(ref="#/definitions/JobTitle"),
158
     *                 ),
159
     *             ),
160
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
161
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
162
     *         )
163
     *     ),
164
     *     @SWG\Parameter(
165
     *         name="page",
166
     *         in="query",
167
     *         description="Page number for pagination",
168
     *         required=true,
169
     *         type="string",
170
     *         default="1"
171
     *     ),
172
     *     @SWG\Parameter(
173
     *         name="Authorization",
174
     *         in="header",
175
     *         description="JWT Token",
176
     *         required=true,
177
     *         type="string",
178
     *         default="Bearer "
179
     *     ),
180
     * )
181
     *
182
     * @param JobTitleRequest $request
183
     *
184
     * @return \Dingo\Api\Http\Response
185
     *
186
     * @author Bertrand Kintanar <[email protected]>
187
     */
188
    public function index(JobTitleRequest $request)
189
    {
190
        $job_titles = $this->job_title->paginate(ROWS_PER_PAGE);
191
192
        $data = ['data' => $job_titles, 'table' => $this->setupDataTable($job_titles)];
193
194
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
195
    }
196
197
    /**
198
     * Setup table for job title.
199
     *
200
     * @param $job_titles
201
     *
202
     * @return array
203
     *
204
     * @author Bertrand Kintanar <[email protected]>
205
     */
206
    protected function setupDataTable($job_titles)
207
    {
208
        $table = [];
209
210
        $table['title'] = 'Job Titles';
211
        $table['permission'] = 'admin.job.titles';
212
        $table['headers'] = ['Id', 'Name', 'Description'];
213
        $table['model'] = [
214
            'singular' => 'job_title',
215
            'plural'   => 'job_titles',
216
            'dashed'   => 'job-titles',
217
        ];
218
        $table['items'] = $job_titles;
219
220
        return $table;
221
    }
222
223
    /**
224
     * Stores a single instance of Job Title.
225
     *
226
     * @SWG\Post(
227
     *     path="/admin/job/titles",
228
     *     description="This route provides the ability to store a single instance of Job Title.",
229
     *     tags={"Administration"},
230
     *     consumes={"application/json"},
231
     *     summary="Stores a single instance of Employment Status.",
232
     *     @SWG\Response(response="201", description="Success",
233
     *         @SWG\Schema(
234
     *             title="data",
235
     *             type="object",
236
     *             required={"job_title", "message", "status_code"},
237
     *             @SWG\Property(property="job_title", ref="#/definitions/JobTitle"),
238
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
239
     *             @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"),
240
     *         )
241
     *     ),
242
     *     @SWG\Response(response="400", description="Token not provided",
243
     *         @SWG\Schema(
244
     *             title="data",
245
     *             type="object",
246
     *             required={"message", "status_code", "debug"},
247
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
248
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
249
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
250
     *         )
251
     *     ),
252
     *     @SWG\Response(response="422", description="Unable to add record to the database.",
253
     *         @SWG\Schema(
254
     *             title="data",
255
     *             type="object",
256
     *             required={"message", "status_code"},
257
     *             @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"),
258
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
259
     *         )
260
     *     ),
261
     *     @SWG\Parameter(
262
     *         name="job_title",
263
     *         in="body",
264
     *         required=true,
265
     *         @SWG\Property(ref="#/definitions/JobTitle")
266
     *     ),
267
     *     @SWG\Parameter(
268
     *         name="Authorization",
269
     *         in="header",
270
     *         description="JWT Token",
271
     *         required=true,
272
     *         type="string",
273
     *         default="Bearer "
274
     *     ),
275
     * )
276
     *
277
     * @param JobTitleRequest $request
278
     *
279
     * @return \Dingo\Api\Http\Response
280
     *
281
     * @author Bertrand Kintanar <[email protected]>
282
     */
283
    public function store(JobTitleRequest $request)
284
    {
285
        return $this->storeModel($request, $this->job_title, 'job_title');
286
    }
287
288
    /**
289
     * Retrieves a single instance of Job Title.
290
     *
291
     * @SWG\Get(
292
     *     path="/admin/job/titles/{job_title}",
293
     *     description="This route provides the ability to retrieve a single instance of Job Title.",
294
     *     tags={"Administration"},
295
     *     consumes={"application/json"},
296
     *     summary="Retrieves a single instance of Job Title.",
297
     *     @SWG\Response(response="200", description="Success",
298
     *         @SWG\Schema(
299
     *             title="data",
300
     *             type="object",
301
     *             required={"employment_status", "message", "status_code"},
302
     *             @SWG\Property(property="employment_status", ref="#/definitions/JobTitle"),
303
     *             @SWG\Property(property="message", type="string", default="Record successfully retrieved.", description="Status message from server"),
304
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
305
     *         )
306
     *     ),
307
     *     @SWG\Response(response="400", description="Token not provided",
308
     *         @SWG\Schema(
309
     *             title="data",
310
     *             type="object",
311
     *             required={"message", "status_code", "debug"},
312
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
313
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
314
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
315
     *         )
316
     *     ),
317
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
318
     *         @SWG\Schema(
319
     *             title="data",
320
     *             type="object",
321
     *             required={"message", "status_code"},
322
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
323
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
324
     *         )
325
     *     ),
326
     *     @SWG\Parameter(
327
     *         name="job_title",
328
     *         in="path",
329
     *         description="Job title id to be retrieved.",
330
     *         required=true,
331
     *         type="integer",
332
     *         format="int64",
333
     *         default=1,
334
     *     ),
335
     *     @SWG\Parameter(
336
     *         name="Authorization",
337
     *         in="header",
338
     *         description="JWT Token",
339
     *         required=true,
340
     *         type="string",
341
     *         default="Bearer "
342
     *     ),
343
     * )
344
     *
345
     * @param JobTitle $job_title
346
     *
347
     * @return \Dingo\Api\Http\Response
348
     *
349
     * @author Bertrand Kintanar <[email protected]>
350
     */
351
    public function show(JobTitle $job_title)
352
    {
353
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, compact('job_title'));
354
    }
355
356
    /**
357
     * Updates a single instance of Job Title.
358
     *
359
     * @SWG\Patch(
360
     *     path="/admin/job/titles",
361
     *     description="This route provides the ability to update a single instance of Job Title.",
362
     *     tags={"Administration"},
363
     *     consumes={"application/json"},
364
     *     summary="Updates a single instance of Employment Status.",
365
     *     @SWG\Response(response="200", description="Success",
366
     *         @SWG\Schema(
367
     *             title="data",
368
     *             type="object",
369
     *             required={"message", "status_code"},
370
     *             @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"),
371
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
372
     *         )
373
     *     ),
374
     *     @SWG\Response(response="400", description="Token not provided",
375
     *         @SWG\Schema(
376
     *             title="data",
377
     *             type="object",
378
     *             required={"message", "status_code", "debug"},
379
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
380
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
381
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
382
     *         )
383
     *     ),
384
     *     @SWG\Response(response="404", description="Unable to retrieve record from database.",
385
     *         @SWG\Schema(
386
     *             title="data",
387
     *             type="object",
388
     *             required={"message", "status_code", "debug"},
389
     *             @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"),
390
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
391
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
392
     *         )
393
     *     ),
394
     *     @SWG\Response(response="422", description="Unable to update record.",
395
     *         @SWG\Schema(
396
     *             title="data",
397
     *             type="object",
398
     *             required={"message", "status_code"},
399
     *             @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"),
400
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
401
     *         )
402
     *     ),
403
     *     @SWG\Parameter(
404
     *         name="job_title",
405
     *         in="body",
406
     *         required=true,
407
     *         description="job title object that needs to be updated",
408
     *         @SWG\Property(ref="#/definitions/JobTitle")
409
     *     ),
410
     *     @SWG\Parameter(
411
     *         name="Authorization",
412
     *         in="header",
413
     *         description="JWT Token",
414
     *         required=true,
415
     *         type="string",
416
     *         default="Bearer "
417
     *     ),
418
     * )
419
     *
420
     * @param JobTitleRequest $request
421
     *
422
     * @return \Dingo\Api\Http\Response
423
     *
424
     * @author Bertrand Kintanar <[email protected]>
425
     */
426
    public function update(JobTitleRequest $request)
427
    {
428
        return $this->updateModel($request, $this->job_title, ['name', 'description']);
429
    }
430
}
431

app/Api/Controllers/Admin/Job/PayGradesController.php 1 location

@@ 33-430 (lines=398) @@
30
/**
31
 * Class PayGradesController.
32
 */
33
class PayGradesController extends BaseController
34
{
35
    /**
36
     * @var PayGrade
37
     */
38
    protected $pay_grade;
39
40
    /**
41
     * @param PayGrade $pay_grade
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45
    public function __construct(PayGrade $pay_grade)
46
    {
47
        $this->pay_grade = $pay_grade;
48
    }
49
50
    /**
51
     * Deletes a single instance of Pay Grade.
52
     *
53
     * @SWG\Delete(
54
     *     path="/admin/job/pay-grades/{pay_grade}",
55
     *     description="This route provides the ability to delete a Pay Grade.",
56
     *     tags={"Administration"},
57
     *     consumes={"application/json"},
58
     *     summary="Deletes a single instance of Pay Grade.",
59
     *     @SWG\Response(response="200", description="Success",
60
     *         @SWG\Schema(
61
     *             title="data",
62
     *             type="object",
63
     *             required={"message", "status_code"},
64
     *             @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"),
65
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
66
     *         )
67
     *     ),
68
     *     @SWG\Response(response="400", description="Token not provided",
69
     *         @SWG\Schema(
70
     *             title="data",
71
     *             type="object",
72
     *             required={"message", "status_code", "debug"},
73
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
74
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
75
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
76
     *         )
77
     *     ),
78
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
79
     *         @SWG\Schema(
80
     *             title="data",
81
     *             type="object",
82
     *             required={"message", "status_code"},
83
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
84
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
85
     *         )
86
     *     ),
87
     *     @SWG\Parameter(
88
     *         name="pay_grade",
89
     *         in="path",
90
     *         description="Pay grade id to be deleted",
91
     *         required=true,
92
     *         type="integer",
93
     *         format="int64",
94
     *         default=1,
95
     *     ),
96
     *     @SWG\Parameter(
97
     *         name="Authorization",
98
     *         in="header",
99
     *         description="JWT Token",
100
     *         required=true,
101
     *         type="string",
102
     *         default="Bearer "
103
     *     ),
104
     * )
105
     *
106
     * @param PayGrade        $pay_grade
107
     * @param PayGradeRequest $request
108
     *
109
     * @return \Dingo\Api\Http\Response
110
     *
111
     * @author Bertrand Kintanar <[email protected]>
112
     */
113
    public function destroy(PayGrade $pay_grade, PayGradeRequest $request)
114
    {
115
        return $this->destroyModel($pay_grade, $this->pay_grade);
116
    }
117
118
    /**
119
     * Retrieves a paginate aware collection of Pay Grades.
120
     *
121
     * @SWG\Get(
122
     *     path="/admin/job/pay-grades",
123
     *     description="This route provides the ability to retrieve a paginate aware collection of Pay Grades.",
124
     *     tags={"Administration"},
125
     *     consumes={"application/json"},
126
     *     summary="Retrieves a paginate aware collection of Pay Grades.",
127
     *     @SWG\Response(response="200", description="Success",
128
     *         @SWG\Schema(
129
     *             title="data",
130
     *             type="object",
131
     *             required={"data", "table", "message", "status_code"},
132
     *             @SWG\Property(property="data", type="object",
133
     *                 @SWG\Property(property="total", type="integer", default=22),
134
     *                 @SWG\Property(property="per_page", type="integer", default=10),
135
     *                 @SWG\Property(property="current_page", type="integer", default=1),
136
     *                 @SWG\Property(property="last_page", type="integer", default=3),
137
     *                 @SWG\Property(property="next_page_url", type="string", default="https://api.hris.dev/api/admin/job/pay-grades?page=2"),
138
     *                 @SWG\Property(property="prev_page_url", type="string", default="null"),
139
     *                 @SWG\Property(property="from", type="integer", default=1),
140
     *                 @SWG\Property(property="to", type="integer", default=10),
141
     *                 @SWG\Property(property="data", type="array",
142
     *                     @SWG\Items(ref="#/definitions/PayGrade"),
143
     *                 ),
144
     *             ),
145
     *             @SWG\Property(property="table", type="object",
146
     *                 @SWG\Property(property="title", type="string", default="Pay Grade"),
147
     *                 @SWG\Property(property="permission", type="string", default="admin.job.pay-grades"),
148
     *                 @SWG\Property(property="headers", type="array",
149
     *                     @SWG\Items(title="Id", type="string", default="Id"),
150
     *                 ),
151
     *                 @SWG\Property(property="model", type="object",
152
     *                     @SWG\Property(property="singular", type="string", default="pay_grade"),
153
     *                     @SWG\Property(property="plural", type="string", default="pay_grades"),
154
     *                     @SWG\Property(property="dashed", type="string", default="pay-grades"),
155
     *                 ),
156
     *                 @SWG\Property(property="data", type="array",
157
     *                     @SWG\Items(ref="#/definitions/PayGrade"),
158
     *                 ),
159
     *             ),
160
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
161
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
162
     *         )
163
     *     ),
164
     *     @SWG\Parameter(
165
     *         name="page",
166
     *         in="query",
167
     *         description="Page number for pagination",
168
     *         required=true,
169
     *         type="string",
170
     *         default="1"
171
     *     ),
172
     *     @SWG\Parameter(
173
     *         name="Authorization",
174
     *         in="header",
175
     *         description="JWT Token",
176
     *         required=true,
177
     *         type="string",
178
     *         default="Bearer "
179
     *     ),
180
     * )
181
     *
182
     * @param PayGradeRequest $request
183
     *
184
     * @return \Dingo\Api\Http\Response
185
     *
186
     * @author Bertrand Kintanar <[email protected]>
187
     */
188
    public function index(PayGradeRequest $request)
189
    {
190
        $pay_grades = $this->pay_grade->paginate(ROWS_PER_PAGE);
191
192
        $data = ['data' => $pay_grades, 'table' => $this->setupDataTable($pay_grades)];
193
194
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
195
    }
196
197
    /**
198
     * Setup table for pay grade.
199
     *
200
     * @param $pay_grades
201
     *
202
     * @return array
203
     *
204
     * @author Bertrand Kintanar <[email protected]>
205
     */
206
    protected function setupDataTable($pay_grades)
207
    {
208
        $table = [];
209
210
        $table['title'] = 'Pay Grades';
211
        $table['permission'] = 'admin.job.pay-grades';
212
        $table['headers'] = ['Id', 'Pay Grade', 'Minimum Salary', 'Maximum Salary'];
213
        $table['model'] = [
214
            'singular' => 'pay_grade',
215
            'plural'   => 'pay_grades',
216
            'dashed'   => 'pay-grades',
217
        ];
218
        $table['items'] = $pay_grades;
219
220
        return $table;
221
    }
222
223
    /**
224
     * Stores a single instance of Pay Grade.
225
     *
226
     * @SWG\Post(
227
     *     path="/admin/job/pay-grades",
228
     *     description="This route provides the ability to store a single instance of Pay Grade.",
229
     *     tags={"Administration"},
230
     *     consumes={"application/json"},
231
     *     summary="Stores a single instance of Pay Grade.",
232
     *     @SWG\Response(response="201", description="Success",
233
     *         @SWG\Schema(
234
     *             title="data",
235
     *             type="object",
236
     *             required={"pay_grade", "message", "status_code"},
237
     *             @SWG\Property(property="pay_grade", ref="#/definitions/PayGrade"),
238
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
239
     *             @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"),
240
     *         )
241
     *     ),
242
     *     @SWG\Response(response="400", description="Token not provided",
243
     *         @SWG\Schema(
244
     *             title="data",
245
     *             type="object",
246
     *             required={"message", "status_code", "debug"},
247
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
248
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
249
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
250
     *         )
251
     *     ),
252
     *     @SWG\Response(response="422", description="Unable to add record to the database.",
253
     *         @SWG\Schema(
254
     *             title="data",
255
     *             type="object",
256
     *             required={"message", "status_code"},
257
     *             @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"),
258
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
259
     *         )
260
     *     ),
261
     *     @SWG\Parameter(
262
     *         name="pay_grade",
263
     *         in="body",
264
     *         required=true,
265
     *         @SWG\Property(ref="#/definitions/PayGrade")
266
     *     ),
267
     *     @SWG\Parameter(
268
     *         name="Authorization",
269
     *         in="header",
270
     *         description="JWT Token",
271
     *         required=true,
272
     *         type="string",
273
     *         default="Bearer "
274
     *     ),
275
     * )
276
     *
277
     * @param PayGradeRequest $request
278
     *
279
     * @return \Dingo\Api\Http\Response
280
     *
281
     * @author Bertrand Kintanar <[email protected]>
282
     */
283
    public function store(PayGradeRequest $request)
284
    {
285
        return $this->storeModel($request, $this->pay_grade, 'pay_grade');
286
    }
287
288
    /**
289
     * Retrieves a single instance of Pay Grade.
290
     *
291
     * @SWG\Get(
292
     *     path="/admin/job/pay-grades/{pay_grade}",
293
     *     description="This route provides the ability to retrieve a single instance of Pay Grade.",
294
     *     tags={"Administration"},
295
     *     consumes={"application/json"},
296
     *     summary="Retrieves a single instance of Pay Grade.",
297
     *     @SWG\Response(response="200", description="Success",
298
     *         @SWG\Schema(
299
     *             title="data",
300
     *             type="object",
301
     *             required={"employment_status", "message", "status_code"},
302
     *             @SWG\Property(property="employment_status", ref="#/definitions/PayGrade"),
303
     *             @SWG\Property(property="message", type="string", default="Record successfully retrieved.", description="Status message from server"),
304
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
305
     *         )
306
     *     ),
307
     *     @SWG\Response(response="400", description="Token not provided",
308
     *         @SWG\Schema(
309
     *             title="data",
310
     *             type="object",
311
     *             required={"message", "status_code", "debug"},
312
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
313
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
314
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
315
     *         )
316
     *     ),
317
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
318
     *         @SWG\Schema(
319
     *             title="data",
320
     *             type="object",
321
     *             required={"message", "status_code"},
322
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
323
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
324
     *         )
325
     *     ),
326
     *     @SWG\Parameter(
327
     *         name="pay_grade",
328
     *         in="path",
329
     *         description="Pay grade id to be retrieved.",
330
     *         required=true,
331
     *         type="integer",
332
     *         format="int64",
333
     *         default=1,
334
     *     ),
335
     *     @SWG\Parameter(
336
     *         name="Authorization",
337
     *         in="header",
338
     *         description="JWT Token",
339
     *         required=true,
340
     *         type="string",
341
     *         default="Bearer "
342
     *     ),
343
     * )
344
     *
345
     * @param PayGrade $pay_grade
346
     *
347
     * @return \Dingo\Api\Http\Response
348
     *
349
     * @author Bertrand Kintanar <[email protected]>
350
     */
351
    public function show(PayGrade $pay_grade)
352
    {
353
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, compact('pay_grade'));
354
    }
355
356
    /**
357
     * Updates a single instance of Pay Grade.
358
     *
359
     * @SWG\Patch(
360
     *     path="/admin/job/pay-grades",
361
     *     description="This route provides the ability to update a single instance of Pay Grade.",
362
     *     tags={"Administration"},
363
     *     consumes={"application/json"},
364
     *     summary="Updates a single instance of Pay Grade.",
365
     *     @SWG\Response(response="200", description="Success",
366
     *         @SWG\Schema(
367
     *             title="data",
368
     *             type="object",
369
     *             required={"message", "status_code"},
370
     *             @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"),
371
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
372
     *         )
373
     *     ),
374
     *     @SWG\Response(response="400", description="Token not provided",
375
     *         @SWG\Schema(
376
     *             title="data",
377
     *             type="object",
378
     *             required={"message", "status_code", "debug"},
379
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
380
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
381
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
382
     *         )
383
     *     ),
384
     *     @SWG\Response(response="404", description="Unable to retrieve record from database.",
385
     *         @SWG\Schema(
386
     *             title="data",
387
     *             type="object",
388
     *             required={"message", "status_code", "debug"},
389
     *             @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"),
390
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
391
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
392
     *         )
393
     *     ),
394
     *     @SWG\Response(response="422", description="Unable to update record.",
395
     *         @SWG\Schema(
396
     *             title="data",
397
     *             type="object",
398
     *             required={"message", "status_code"},
399
     *             @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"),
400
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
401
     *         )
402
     *     ),
403
     *     @SWG\Parameter(
404
     *         name="pay_grade",
405
     *         in="body",
406
     *         required=true,
407
     *         description="pay grade object that needs to be updated",
408
     *         @SWG\Property(ref="#/definitions/PayGrade")
409
     *     ),
410
     *     @SWG\Parameter(
411
     *         name="Authorization",
412
     *         in="header",
413
     *         description="JWT Token",
414
     *         required=true,
415
     *         type="string",
416
     *         default="Bearer "
417
     *     ),
418
     * )
419
     *
420
     * @param PayGradeRequest $request
421
     *
422
     * @return \Dingo\Api\Http\Response
423
     *
424
     * @author Bertrand Kintanar <[email protected]>
425
     */
426
    public function update(PayGradeRequest $request)
427
    {
428
        return $this->updateModel($request, $this->pay_grade);
429
    }
430
}
431

app/Api/Controllers/Admin/Qualifications/EducationsController.php 1 location

@@ 33-430 (lines=398) @@
30
/**
31
 * Class EducationsController.
32
 */
33
class EducationsController extends BaseController
34
{
35
    /**
36
     * @var EducationLevel
37
     */
38
    protected $education_level;
39
40
    /**
41
     * @param EducationLevel $education_level
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45
    public function __construct(EducationLevel $education_level)
46
    {
47
        $this->education_level = $education_level;
48
    }
49
50
    /**
51
     * Deletes a single instance of Education Level.
52
     *
53
     * @SWG\Delete(
54
     *     path="/admin/qualifications/educations/{education_level}",
55
     *     description="This route provides the ability to delete a Education Level.",
56
     *     tags={"Administration"},
57
     *     consumes={"application/json"},
58
     *     summary="Deletes a single instance of Education Level.",
59
     *     @SWG\Response(response="200", description="Success",
60
     *         @SWG\Schema(
61
     *             title="data",
62
     *             type="object",
63
     *             required={"message", "status_code"},
64
     *             @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"),
65
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
66
     *         )
67
     *     ),
68
     *     @SWG\Response(response="400", description="Token not provided",
69
     *         @SWG\Schema(
70
     *             title="data",
71
     *             type="object",
72
     *             required={"message", "status_code", "debug"},
73
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
74
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
75
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
76
     *         )
77
     *     ),
78
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
79
     *         @SWG\Schema(
80
     *             title="data",
81
     *             type="object",
82
     *             required={"message", "status_code"},
83
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
84
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
85
     *         )
86
     *     ),
87
     *     @SWG\Parameter(
88
     *         name="education_level",
89
     *         in="path",
90
     *         description="Education level id to be deleted",
91
     *         required=true,
92
     *         type="integer",
93
     *         format="int64",
94
     *         default=1,
95
     *     ),
96
     *     @SWG\Parameter(
97
     *         name="Authorization",
98
     *         in="header",
99
     *         description="JWT Token",
100
     *         required=true,
101
     *         type="string",
102
     *         default="Bearer "
103
     *     ),
104
     * )
105
     *
106
     * @param EducationLevel        $education_level
107
     * @param EducationLevelRequest $request
108
     *
109
     * @return \Dingo\Api\Http\Response
110
     *
111
     * @author Bertrand Kintanar <[email protected]>
112
     */
113
    public function destroy(EducationLevel $education_level, EducationLevelRequest $request)
114
    {
115
        return $this->destroyModel($education_level, $this->education_level);
116
    }
117
118
    /**
119
     * Retrieves a paginate aware collection of Education Level.
120
     *
121
     * @SWG\Get(
122
     *     path="/admin/qualifications/educations",
123
     *     description="This route provides the ability to retrieve a paginate aware collection of Education Levels.",
124
     *     tags={"Administration"},
125
     *     consumes={"application/json"},
126
     *     summary="Retrieves a paginate aware collection of Education Level.",
127
     *     @SWG\Response(response="200", description="Success",
128
     *         @SWG\Schema(
129
     *             title="data",
130
     *             type="object",
131
     *             required={"data", "table", "message", "status_code"},
132
     *             @SWG\Property(property="data", type="object",
133
     *                 @SWG\Property(property="total", type="integer", default=22),
134
     *                 @SWG\Property(property="per_page", type="integer", default=10),
135
     *                 @SWG\Property(property="current_page", type="integer", default=1),
136
     *                 @SWG\Property(property="last_page", type="integer", default=3),
137
     *                 @SWG\Property(property="next_page_url", type="string", default="https://api.hris.dev/api/admin/qualifications/educations?page=2"),
138
     *                 @SWG\Property(property="prev_page_url", type="string", default="null"),
139
     *                 @SWG\Property(property="from", type="integer", default=1),
140
     *                 @SWG\Property(property="to", type="integer", default=10),
141
     *                 @SWG\Property(property="data", type="array",
142
     *                     @SWG\Items(ref="#/definitions/EducationLevel"),
143
     *                 ),
144
     *             ),
145
     *             @SWG\Property(property="table", type="object",
146
     *                 @SWG\Property(property="title", type="string", default="Education Level"),
147
     *                 @SWG\Property(property="permission", type="string", default="admin.qualifications.educations"),
148
     *                 @SWG\Property(property="headers", type="array",
149
     *                     @SWG\Items(title="Id", type="string", default="Id"),
150
     *                 ),
151
     *                 @SWG\Property(property="model", type="object",
152
     *                     @SWG\Property(property="singular", type="string", default="education_level"),
153
     *                     @SWG\Property(property="plural", type="string", default="education_levels"),
154
     *                     @SWG\Property(property="dashed", type="string", default="education-levels"),
155
     *                 ),
156
     *                 @SWG\Property(property="data", type="array",
157
     *                     @SWG\Items(ref="#/definitions/EducationLevel"),
158
     *                 ),
159
     *             ),
160
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
161
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
162
     *         )
163
     *     ),
164
     *     @SWG\Parameter(
165
     *         name="page",
166
     *         in="query",
167
     *         description="Page number for pagination",
168
     *         required=true,
169
     *         type="string",
170
     *         default="1"
171
     *     ),
172
     *     @SWG\Parameter(
173
     *         name="Authorization",
174
     *         in="header",
175
     *         description="JWT Token",
176
     *         required=true,
177
     *         type="string",
178
     *         default="Bearer "
179
     *     ),
180
     * )
181
     *
182
     * @param EducationLevelRequest $request
183
     *
184
     * @return \Dingo\Api\Http\Response
185
     *
186
     * @author Bertrand Kintanar <[email protected]>
187
     */
188
    public function index(EducationLevelRequest $request)
189
    {
190
        $education_levels = $this->education_level->paginate(ROWS_PER_PAGE);
191
192
        $data = ['data' => $education_levels, 'table' => $this->setupDataTable($education_levels)];
193
194
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
195
    }
196
197
    /**
198
     * Setup table for education level.
199
     *
200
     * @param $education_levels
201
     *
202
     * @return array
203
     *
204
     * @author Bertrand Kintanar <[email protected]>
205
     */
206
    protected function setupDataTable($education_levels)
207
    {
208
        $table = [];
209
210
        $table['title'] = 'Education Levels';
211
        $table['permission'] = 'admin.qualifications.educations';
212
        $table['headers'] = ['Id', 'Education Level'];
213
        $table['model'] = [
214
            'singular' => 'education_level',
215
            'plural'   => 'education_levels',
216
            'dashed'   => 'education-levels',
217
        ];
218
        $table['items'] = $education_levels;
219
220
        return $table;
221
    }
222
223
    /**
224
     * Stores a single instance of Education Level.
225
     *
226
     * @SWG\Post(
227
     *     path="/admin/qualifications/educations",
228
     *     description="This route provides the ability to store a single instance of Education Level.",
229
     *     tags={"Administration"},
230
     *     consumes={"application/json"},
231
     *     summary="Stores a single instance of Education Level.",
232
     *     @SWG\Response(response="201", description="Success",
233
     *         @SWG\Schema(
234
     *             title="data",
235
     *             type="object",
236
     *             required={"education_level", "message", "status_code"},
237
     *             @SWG\Property(property="education_level", ref="#/definitions/EducationLevel"),
238
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
239
     *             @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"),
240
     *         )
241
     *     ),
242
     *     @SWG\Response(response="400", description="Token not provided",
243
     *         @SWG\Schema(
244
     *             title="data",
245
     *             type="object",
246
     *             required={"message", "status_code", "debug"},
247
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
248
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
249
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
250
     *         )
251
     *     ),
252
     *     @SWG\Response(response="422", description="Unable to add record to the database.",
253
     *         @SWG\Schema(
254
     *             title="data",
255
     *             type="object",
256
     *             required={"message", "status_code"},
257
     *             @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"),
258
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
259
     *         )
260
     *     ),
261
     *     @SWG\Parameter(
262
     *         name="education_level",
263
     *         in="body",
264
     *         required=true,
265
     *         @SWG\Property(ref="#/definitions/EducationLevel")
266
     *     ),
267
     *     @SWG\Parameter(
268
     *         name="Authorization",
269
     *         in="header",
270
     *         description="JWT Token",
271
     *         required=true,
272
     *         type="string",
273
     *         default="Bearer "
274
     *     ),
275
     * )
276
     *
277
     * @param EducationLevelRequest $request
278
     *
279
     * @return \Dingo\Api\Http\Response
280
     *
281
     * @author Bertrand Kintanar <[email protected]>
282
     */
283
    public function store(EducationLevelRequest $request)
284
    {
285
        return $this->storeModel($request, $this->education_level, 'education_level');
286
    }
287
288
    /**
289
     * Retrieves a single instance of Education Level.
290
     *
291
     * @SWG\Get(
292
     *     path="/admin/qualifications/educations/{education_level}",
293
     *     description="This route provides the ability to retrieve a single instance of Education Level.",
294
     *     tags={"Administration"},
295
     *     consumes={"application/json"},
296
     *     summary="Retrieves a single instance of Education Level.",
297
     *     @SWG\Response(response="200", description="Success",
298
     *         @SWG\Schema(
299
     *             title="data",
300
     *             type="object",
301
     *             required={"employment_status", "message", "status_code"},
302
     *             @SWG\Property(property="employment_status", ref="#/definitions/EducationLevel"),
303
     *             @SWG\Property(property="message", type="string", default="Record successfully retrieved.", description="Status message from server"),
304
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
305
     *         )
306
     *     ),
307
     *     @SWG\Response(response="400", description="Token not provided",
308
     *         @SWG\Schema(
309
     *             title="data",
310
     *             type="object",
311
     *             required={"message", "status_code", "debug"},
312
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
313
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
314
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
315
     *         )
316
     *     ),
317
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
318
     *         @SWG\Schema(
319
     *             title="data",
320
     *             type="object",
321
     *             required={"message", "status_code"},
322
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
323
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
324
     *         )
325
     *     ),
326
     *     @SWG\Parameter(
327
     *         name="education_level",
328
     *         in="path",
329
     *         description="Education level id to be retrieved.",
330
     *         required=true,
331
     *         type="integer",
332
     *         format="int64",
333
     *         default=1,
334
     *     ),
335
     *     @SWG\Parameter(
336
     *         name="Authorization",
337
     *         in="header",
338
     *         description="JWT Token",
339
     *         required=true,
340
     *         type="string",
341
     *         default="Bearer "
342
     *     ),
343
     * )
344
     *
345
     * @param EducationLevel $education_level
346
     *
347
     * @return \Dingo\Api\Http\Response
348
     *
349
     * @author Bertrand Kintanar <[email protected]>
350
     */
351
    public function show(EducationLevel $education_level)
352
    {
353
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, compact('education_level'));
354
    }
355
356
    /**
357
     * Updates a single instance of Education Level.
358
     *
359
     * @SWG\Patch(
360
     *     path="/admin/qualifications/educations",
361
     *     description="This route provides the ability to update a single instance of Education Level.",
362
     *     tags={"Administration"},
363
     *     consumes={"application/json"},
364
     *     summary="Updates a single instance of Education Level.",
365
     *     @SWG\Response(response="200", description="Success",
366
     *         @SWG\Schema(
367
     *             title="data",
368
     *             type="object",
369
     *             required={"message", "status_code"},
370
     *             @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"),
371
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
372
     *         )
373
     *     ),
374
     *     @SWG\Response(response="400", description="Token not provided",
375
     *         @SWG\Schema(
376
     *             title="data",
377
     *             type="object",
378
     *             required={"message", "status_code", "debug"},
379
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
380
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
381
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
382
     *         )
383
     *     ),
384
     *     @SWG\Response(response="404", description="Unable to retrieve record from database.",
385
     *         @SWG\Schema(
386
     *             title="data",
387
     *             type="object",
388
     *             required={"message", "status_code", "debug"},
389
     *             @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"),
390
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
391
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
392
     *         )
393
     *     ),
394
     *     @SWG\Response(response="422", description="Unable to update record.",
395
     *         @SWG\Schema(
396
     *             title="data",
397
     *             type="object",
398
     *             required={"message", "status_code"},
399
     *             @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"),
400
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
401
     *         )
402
     *     ),
403
     *     @SWG\Parameter(
404
     *         name="education_level",
405
     *         in="body",
406
     *         required=true,
407
     *         description="education level object that needs to be updated",
408
     *         @SWG\Property(ref="#/definitions/EducationLevel")
409
     *     ),
410
     *     @SWG\Parameter(
411
     *         name="Authorization",
412
     *         in="header",
413
     *         description="JWT Token",
414
     *         required=true,
415
     *         type="string",
416
     *         default="Bearer "
417
     *     ),
418
     * )
419
     *
420
     * @param EducationLevelRequest $request
421
     *
422
     * @return \Dingo\Api\Http\Response
423
     *
424
     * @author Bertrand Kintanar <[email protected]>
425
     */
426
    public function update(EducationLevelRequest $request)
427
    {
428
        return $this->updateModel($request, $this->education_level);
429
    }
430
}
431

app/Api/Controllers/PIM/Configuration/TerminationReasonsController.php 1 location

@@ 33-430 (lines=398) @@
30
/**
31
 * Class TerminationReasonsController.
32
 */
33
class TerminationReasonsController extends BaseController
34
{
35
    /**
36
     * @var TerminationReason
37
     */
38
    protected $termination_reason;
39
40
    /**
41
     * @param TerminationReason $termination_reason
42
     *
43
     * @author Bertrand Kintanar <[email protected]>
44
     */
45
    public function __construct(TerminationReason $termination_reason)
46
    {
47
        $this->termination_reason = $termination_reason;
48
    }
49
50
    /**
51
     * Deletes a single instance of Termination Reason.
52
     *
53
     * @SWG\Delete(
54
     *     path="/pim/configuration/termination-reasons/{termination_reason}",
55
     *     description="This route provides the ability to delete a Termination Reason.",
56
     *     tags={"PIM - Configuration"},
57
     *     consumes={"application/json"},
58
     *     summary="Deletes a single instance of Termination Reason.",
59
     *     @SWG\Response(response="200", description="Success",
60
     *         @SWG\Schema(
61
     *             title="data",
62
     *             type="object",
63
     *             required={"message", "status_code"},
64
     *             @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"),
65
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
66
     *         )
67
     *     ),
68
     *     @SWG\Response(response="400", description="Token not provided",
69
     *         @SWG\Schema(
70
     *             title="data",
71
     *             type="object",
72
     *             required={"message", "status_code", "debug"},
73
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
74
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
75
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
76
     *         )
77
     *     ),
78
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
79
     *         @SWG\Schema(
80
     *             title="data",
81
     *             type="object",
82
     *             required={"message", "status_code"},
83
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
84
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
85
     *         )
86
     *     ),
87
     *     @SWG\Parameter(
88
     *         name="termination_reason",
89
     *         in="path",
90
     *         description="Termination reason id to be deleted",
91
     *         required=true,
92
     *         type="integer",
93
     *         format="int64",
94
     *         default=1,
95
     *     ),
96
     *     @SWG\Parameter(
97
     *         name="Authorization",
98
     *         in="header",
99
     *         description="JWT Token",
100
     *         required=true,
101
     *         type="string",
102
     *         default="Bearer "
103
     *     ),
104
     * )
105
     *
106
     * @param TerminationReason        $termination_reason
107
     * @param TerminationReasonRequest $request
108
     *
109
     * @return \Dingo\Api\Http\Response
110
     *
111
     * @author Bertrand Kintanar <[email protected]>
112
     */
113
    public function destroy(TerminationReason $termination_reason, TerminationReasonRequest $request)
114
    {
115
        return $this->destroyModel($termination_reason, $this->termination_reason);
116
    }
117
118
    /**
119
     * Retrieves a paginate aware collection of Termination Reason.
120
     *
121
     * @SWG\Get(
122
     *     path="/pim/configuration/termination-reasons",
123
     *     description="This route provides the ability to retrieve a paginate aware collection of Termination Reasons.",
124
     *     tags={"PIM - Configuration"},
125
     *     consumes={"application/json"},
126
     *     summary="Retrieves a paginate aware collection of Termination Reason.",
127
     *     @SWG\Response(response="200", description="Success",
128
     *         @SWG\Schema(
129
     *             title="data",
130
     *             type="object",
131
     *             required={"data", "table", "message", "status_code"},
132
     *             @SWG\Property(property="data", type="object",
133
     *                 @SWG\Property(property="total", type="integer", default=22),
134
     *                 @SWG\Property(property="per_page", type="integer", default=10),
135
     *                 @SWG\Property(property="current_page", type="integer", default=1),
136
     *                 @SWG\Property(property="last_page", type="integer", default=3),
137
     *                 @SWG\Property(property="next_page_url", type="string", default="https://api.hris.dev/api/pim/configuration/termination-reasons?page=2"),
138
     *                 @SWG\Property(property="prev_page_url", type="string", default="null"),
139
     *                 @SWG\Property(property="from", type="integer", default=1),
140
     *                 @SWG\Property(property="to", type="integer", default=10),
141
     *                 @SWG\Property(property="data", type="array",
142
     *                     @SWG\Items(ref="#/definitions/TerminationReason"),
143
     *                 ),
144
     *             ),
145
     *             @SWG\Property(property="table", type="object",
146
     *                 @SWG\Property(property="title", type="string", default="Termination Reason"),
147
     *                 @SWG\Property(property="permission", type="string", default="pim.configuration.termination-reasons"),
148
     *                 @SWG\Property(property="headers", type="array",
149
     *                     @SWG\Items(title="Id", type="string", default="Id"),
150
     *                 ),
151
     *                 @SWG\Property(property="model", type="object",
152
     *                     @SWG\Property(property="singular", type="string", default="termination_reason"),
153
     *                     @SWG\Property(property="plural", type="string", default="termination_reasons"),
154
     *                     @SWG\Property(property="dashed", type="string", default="termination-reasons"),
155
     *                 ),
156
     *                 @SWG\Property(property="data", type="array",
157
     *                     @SWG\Items(ref="#/definitions/TerminationReason"),
158
     *                 ),
159
     *             ),
160
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
161
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
162
     *         )
163
     *     ),
164
     *     @SWG\Parameter(
165
     *         name="page",
166
     *         in="query",
167
     *         description="Page number for pagination",
168
     *         required=true,
169
     *         type="string",
170
     *         default="1"
171
     *     ),
172
     *     @SWG\Parameter(
173
     *         name="Authorization",
174
     *         in="header",
175
     *         description="JWT Token",
176
     *         required=true,
177
     *         type="string",
178
     *         default="Bearer "
179
     *     ),
180
     * )
181
     *
182
     * @param TerminationReasonRequest $request
183
     *
184
     * @return \Dingo\Api\Http\Response
185
     *
186
     * @author Bertrand Kintanar <[email protected]>
187
     */
188
    public function index(TerminationReasonRequest $request)
189
    {
190
        $termination_reasons = $this->termination_reason->paginate(ROWS_PER_PAGE);
191
192
        $data = ['data' => $termination_reasons, 'table' => $this->setupDataTable($termination_reasons)];
193
194
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, $data);
195
    }
196
197
    /**
198
     * Setup table for termination reason.
199
     *
200
     * @param $termination_reasons
201
     *
202
     * @return array
203
     *
204
     * @author Bertrand Kintanar <[email protected]>
205
     */
206
    protected function setupDataTable($termination_reasons)
207
    {
208
        $table = [];
209
210
        $table['title'] = 'Termination Reasons';
211
        $table['permission'] = 'pim.configuration.termination-reasons';
212
        $table['headers'] = ['Id', 'Name'];
213
        $table['model'] = [
214
            'singular' => 'termination_reason',
215
            'plural'   => 'termination_reasons',
216
            'dashed'   => 'termination-reasons',
217
        ];
218
        $table['items'] = $termination_reasons;
219
220
        return $table;
221
    }
222
223
    /**
224
     * Stores a single instance of Termination Reason.
225
     *
226
     * @SWG\Post(
227
     *     path="/pim/configuration/termination-reasons",
228
     *     description="This route provides the ability to store a single instance of Termination Reason.",
229
     *     tags={"PIM - Configuration"},
230
     *     consumes={"application/json"},
231
     *     summary="Stores a single instance of Termination Reason.",
232
     *     @SWG\Response(response="201", description="Success",
233
     *         @SWG\Schema(
234
     *             title="data",
235
     *             type="object",
236
     *             required={"termination_reason", "message", "status_code"},
237
     *             @SWG\Property(property="termination_reason", ref="#/definitions/TerminationReason"),
238
     *             @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"),
239
     *             @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"),
240
     *         )
241
     *     ),
242
     *     @SWG\Response(response="400", description="Token not provided",
243
     *         @SWG\Schema(
244
     *             title="data",
245
     *             type="object",
246
     *             required={"message", "status_code", "debug"},
247
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
248
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
249
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
250
     *         )
251
     *     ),
252
     *     @SWG\Response(response="422", description="Unable to add record to the database.",
253
     *         @SWG\Schema(
254
     *             title="data",
255
     *             type="object",
256
     *             required={"message", "status_code"},
257
     *             @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"),
258
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
259
     *         )
260
     *     ),
261
     *     @SWG\Parameter(
262
     *         name="termination_reason",
263
     *         in="body",
264
     *         required=true,
265
     *         @SWG\Property(ref="#/definitions/TerminationReason")
266
     *     ),
267
     *     @SWG\Parameter(
268
     *         name="Authorization",
269
     *         in="header",
270
     *         description="JWT Token",
271
     *         required=true,
272
     *         type="string",
273
     *         default="Bearer "
274
     *     ),
275
     * )
276
     *
277
     * @param TerminationReasonRequest $request
278
     *
279
     * @return \Dingo\Api\Http\Response
280
     *
281
     * @author Bertrand Kintanar <[email protected]>
282
     */
283
    public function store(TerminationReasonRequest $request)
284
    {
285
        return $this->storeModel($request, $this->termination_reason, 'termination_reason');
286
    }
287
288
    /**
289
     * Retrieves a single instance of Termination Reason.
290
     *
291
     * @SWG\Get(
292
     *     path="/pim/configuration/termination-reasons/{termination_reason}",
293
     *     description="This route provides the ability to retrieve a single instance of Termination Reason.",
294
     *     tags={"PIM - Configuration"},
295
     *     consumes={"application/json"},
296
     *     summary="Retrieves a single instance of Termination Reason.",
297
     *     @SWG\Response(response="200", description="Success",
298
     *         @SWG\Schema(
299
     *             title="data",
300
     *             type="object",
301
     *             required={"employment_status", "message", "status_code"},
302
     *             @SWG\Property(property="employment_status", ref="#/definitions/TerminationReason"),
303
     *             @SWG\Property(property="message", type="string", default="Record successfully retrieved.", description="Status message from server"),
304
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
305
     *         )
306
     *     ),
307
     *     @SWG\Response(response="400", description="Token not provided",
308
     *         @SWG\Schema(
309
     *             title="data",
310
     *             type="object",
311
     *             required={"message", "status_code", "debug"},
312
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
313
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
314
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
315
     *         )
316
     *     ),
317
     *     @SWG\Response(response="422", description="422 Unprocessable Entity",
318
     *         @SWG\Schema(
319
     *             title="data",
320
     *             type="object",
321
     *             required={"message", "status_code"},
322
     *             @SWG\Property(property="message", type="string", default="422 Unprocessable Entity", description="Status message from server"),
323
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
324
     *         )
325
     *     ),
326
     *     @SWG\Parameter(
327
     *         name="termination_reason",
328
     *         in="path",
329
     *         description="Termination reason id to be retrieved.",
330
     *         required=true,
331
     *         type="integer",
332
     *         format="int64",
333
     *         default=1,
334
     *     ),
335
     *     @SWG\Parameter(
336
     *         name="Authorization",
337
     *         in="header",
338
     *         description="JWT Token",
339
     *         required=true,
340
     *         type="string",
341
     *         default="Bearer "
342
     *     ),
343
     * )
344
     *
345
     * @param TerminationReason $termination_reason
346
     *
347
     * @return \Dingo\Api\Http\Response
348
     *
349
     * @author Bertrand Kintanar <[email protected]>
350
     */
351
    public function show(TerminationReason $termination_reason)
352
    {
353
        return $this->responseAPI(Response::HTTP_OK, SUCCESS_RETRIEVE_MESSAGE, compact('termination_reason'));
354
    }
355
356
    /**
357
     * Updates a single instance of Termination Reason.
358
     *
359
     * @SWG\Patch(
360
     *     path="/pim/configuration/termination-reasons",
361
     *     description="This route provides the ability to update a single instance of Termination Reason.",
362
     *     tags={"PIM - Configuration"},
363
     *     consumes={"application/json"},
364
     *     summary="Updates a single instance of Termination Reason.",
365
     *     @SWG\Response(response="200", description="Success",
366
     *         @SWG\Schema(
367
     *             title="data",
368
     *             type="object",
369
     *             required={"message", "status_code"},
370
     *             @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"),
371
     *             @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"),
372
     *         )
373
     *     ),
374
     *     @SWG\Response(response="400", description="Token not provided",
375
     *         @SWG\Schema(
376
     *             title="data",
377
     *             type="object",
378
     *             required={"message", "status_code", "debug"},
379
     *             @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"),
380
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
381
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
382
     *         )
383
     *     ),
384
     *     @SWG\Response(response="404", description="Unable to retrieve record from database.",
385
     *         @SWG\Schema(
386
     *             title="data",
387
     *             type="object",
388
     *             required={"message", "status_code", "debug"},
389
     *             @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"),
390
     *             @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"),
391
     *             @SWG\Property(property="debug", type="object", description="Debug back trace"),
392
     *         )
393
     *     ),
394
     *     @SWG\Response(response="422", description="Unable to update record.",
395
     *         @SWG\Schema(
396
     *             title="data",
397
     *             type="object",
398
     *             required={"message", "status_code"},
399
     *             @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"),
400
     *             @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"),
401
     *         )
402
     *     ),
403
     *     @SWG\Parameter(
404
     *         name="termination_reason",
405
     *         in="body",
406
     *         required=true,
407
     *         description="termination reason object that needs to be updated",
408
     *         @SWG\Property(ref="#/definitions/TerminationReason")
409
     *     ),
410
     *     @SWG\Parameter(
411
     *         name="Authorization",
412
     *         in="header",
413
     *         description="JWT Token",
414
     *         required=true,
415
     *         type="string",
416
     *         default="Bearer "
417
     *     ),
418
     * )
419
     *
420
     * @param TerminationReasonRequest $request
421
     *
422
     * @return \Dingo\Api\Http\Response
423
     *
424
     * @author Bertrand Kintanar <[email protected]>
425
     */
426
    public function update(TerminationReasonRequest $request)
427
    {
428
        return $this->updateModel($request, $this->termination_reason);
429
    }
430
}
431