Installed laravel-permission and laravel-modules

This commit is contained in:
Gregorio Chiko Putra
2018-07-30 09:26:17 +07:00
parent 70fe3a814c
commit eee570125d
86 changed files with 23539 additions and 253 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use App\Permission;
use Illuminate\Support\Facades\Auth;
class StorePermission extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::user()->can('create-permission');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return Permission::getCreateRules();
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use App\Role;
class StoreRole extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::user()->can('create-role');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return Role::getCreateRules();
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use App\Permission;
use Illuminate\Support\Facades\Auth;
class UpdatePermission extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::user()->can('update-permission');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$id = $this->permission;
return Permission::getUpdateRulesForId($id);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use App\Role;
class UpdateRole extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::user()->can('update-role');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$id = $this->role;
return Role::getUpdateRulesForId($id);
}
}