Code Duplication    Length = 398-398 lines in 5 locations

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

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

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

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

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

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

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

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

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

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