Laraland/app/Http/Requests/UpdatePermission.php
2018-07-30 09:26:17 +07:00

33 lines
624 B
PHP

<?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);
}
}