for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the HRis Software package.
*
* HRis - Human Resource and Payroll System
* @link http://github.com/HB-Co/HRis
*/
namespace HRis\Api\Requests\Admin\Job;
use HRis\Http\Requests\Request;
class JobTitleRequest extends Request
{
* Get the validation rules that apply to the request.
* @return array
* @author Bertrand Kintanar <[email protected]>
public function rules()
if ($this->isMethod('post')) {
return ['name' => 'required|unique:job_titles'];
}
return [];
* Determine if the user is authorized to make this request.
* @return bool
public function authorize()
$permission = 'admin.job.titles';
// Create
return $this->logged_user->hasAccess($permission.'.create');
} // Delete
else {
if ($this->isMethod('delete')) {
return $this->logged_user->hasAccess($permission.'.delete');
} // View
if ($this->isMethod('get')) {
return $this->logged_user->hasAccess($permission.'.view');
} // Update
if ($this->isMethod('patch')) {
return $this->logged_user->hasAccess($permission.'.update');