Installed laravel-permission and laravel-modules
This commit is contained in:
30
app/Http/Requests/StorePermission.php
Normal file
30
app/Http/Requests/StorePermission.php
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user