update code

This commit is contained in:
manhlab
2021-04-07 06:32:42 -04:00
parent 7fb98911a6
commit a4753625f6
779 changed files with 335717 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Attachment;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Document;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Document::find($this->document_id)->creator_id == $this->user()->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'document_id' => 'required|exists:documents,id',
'attachments' => 'required|file',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Attachment;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Attachment;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Attachment::find($this->attachment)->document->creator_id == $this->user()->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Attachment;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Attachment;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Http\Requests\Attachment;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Document;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Document::find($this->document_id)->creator_id == $this->user()->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'document_id' => 'nullable|exists:documents,id',
'name' => 'nullable|string',
'extension' => 'nullable|string',
'size' => 'nullable|numeric',
'path' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Book;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý sổ văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:books,id,'.$this->book,
'name' => 'required|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Book;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý sổ văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Book;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Book;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Book;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý sổ văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:books,id,'.$this->book,
'name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý phòng ban');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'required|string|alpha_dash|max:7|unique:departments,id,'.$this->department,
'name' => 'required|string',
'tel' => 'nullable|alpha_num|max:15|unique:departments,tel,'.$this->tel,
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý phòng ban');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Department;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý phòng ban');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|string|alpha_dash|max:7|unique:departments,id,'.$this->department,
'name' => 'nullable|string',
'tel' => 'nullable|alpha_num|max:15',
];
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Book;
use Illuminate\Support\Str;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$typeName = Str::lower(Book::find($this->book_id)->name);
return $this->user()->hasPermissionTo('Quản lý '. $typeName);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:documents,id',
'symbol' => 'nullable|string|max:30|unique:documents,symbol',
'abstract' => 'nullable|string',
'book_id' => 'required|exists:books,id',
'type_id' => 'required|exists:document_types,id',
'signer_id' => 'required|exists:signers,id',
'creator_id' => 'required|exists:users,id',
'writer_id' => 'nullable|exists:users,id',
'effective_at' => 'required|date',
'sign_at' => 'nullable|date',
'publisher_id' => 'required|exists:organizes,id',
'attachments.*' => 'nullable|file',
'link_id' => 'nullable|exists:documents,id',
];
}
/**
* Get all of the input and files for the request.
*
* @param array|mixed|null $keys
* @return array
*/
public function all($keys = null)
{
$data = parent::all($keys);
$data['creator_id'] = $this->user()->id;
return $data;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Document;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Document::find($this->document)->creator_id == $this->user()->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
class ExportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Báo cáo thống kê');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'book' => 'nullable|exists:books,id',
'type' => 'nullable|exists:document_types,id',
'from' => 'nullable|date',
'to' => 'nullable|date',
'export' => 'required|in:Xlsx,Csv,Xls,Html',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
use App\Entities\Document;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Document::find($this->document)->creator_id == $this->user()->id;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:documents,id,'.$this->document,
'symbol' => 'nullable|string|max:30',
'abstract' => 'nullable|string',
'book_id' => 'nullable|exists:books,id',
'type_id' => 'nullable|exists:document_types,id',
'signer_id' => 'nullable|exists:signers,id',
'writer_id' => 'nullable|exists:users,id',
'effective_at' => 'nullable|date',
'sign_at' => 'nullable|date',
'publisher_id' => 'nullable|exists:organizes,id',
'link_id' => 'nullable|exists:documents,id',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý loại văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'required|alpha_num|max:2|unique:document_types,id',
'name' => 'required|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý loại văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý loại văn bản');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|alpha_num|max:2|unique:document_types,id,'.$this->document_type,
'name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Me;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Me;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'nullable|string',
'email' => 'nullable|email',
'password' => 'nullable|min:6|max:32|confirmed',
'tel' => 'nullable|string',
'birthday' => 'nullable|date',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Organize;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nơi ban hành');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Organize;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nơi ban hành');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Organize;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Organize;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Organize;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nơi ban hành');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Permission;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'nullable|string',
'guard_name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Permission;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Permission;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Permission;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Permission;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'nullable|string',
'guard_name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nhóm');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string',
'guard_name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nhóm');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class GivePermissionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Phân quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class RevokePermissionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Phân quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý nhóm');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'nullable|string',
'guard_name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Signer;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người ký');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:signers,id',
'name' => 'required|string',
'description' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Signer;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người ký');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Signer;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Signer;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Signer;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người ký');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|numeric|unique:signers,id,'.$this->signer,
'name' => 'nullable|string',
'description' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Title;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý chức danh');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'required|string|alpha_dash|max:30|unique:titles,id',
'name' => 'required|string',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Title;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý chức danh');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Title;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Title;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Title;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý chức danh');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|string|alpha_dash|max:30|unique:titles,id,'.$this->title,
'name' => 'nullable|string',
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người dùng');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string',
'email' => 'required|email|unique:users,email',
'password' => 'required|min:6|max:32|confirmed',
'tel' => 'nullable|string|unique:users,tel',
'birthday' => 'nullable|date',
'department_id' => 'nullable|exists:departments,id',
'title_id' => 'nullable|exists:titles,id',
'active' => 'nullable|boolean',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class DestroyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người dùng');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class ExportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người dùng');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'export' => 'required|in:Xlsx,Csv,Xls,Html',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class GivePermissionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Phân quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class GiveRoleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Phân quyền');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class ImportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người dùng');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'data' => 'required|file:Xlsx'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class ShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->hasPermissionTo('Quản lý người dùng');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'nullable|string|unique:users,id,'.$this->user,
'name' => 'nullable|string',
'email' => 'nullable|email|unique:users,email,'.$this->user,
'password' => 'nullable|min:6|max:32|confirmed',
'tel' => 'nullable|string',
'birthday' => 'nullable|date',
'department_id' => 'nullable|exists:departments,id',
'title_id' => 'nullable|exists:titles,id',
'active' => 'nullable|boolean',
];
}
}