public function store()
    {
        $this->validate($this->request, [
            'name'     => 'required',
            'resource' => 'required|alpha_num',
            'slug'     => 'required|unique:permissions,slug',
        ]);

        $permission = Permission::create($this->request->all());
        $permission->syncRoles($this->request->get('roles', []));

        return redirect()->route('administrator.permissions.index');
    }
public function store()
    {
        $this->validate($this->request, [
            'name'     => 'required',
            'resource' => 'required|alpha_num',
            'slug'     => 'required|unique:permissions,slug',
        ]);

        $permission = Permission::create($this->request->all());
        $permission->syncRoles($this->request->get('roles', []));

        return redirect()->route('administrator.permissions.index');
    }
public function store ( ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'resource' => 'required|alpha_num' , 'slug' => 'required|unique:permissions,slug' , ] ) ; $ permission = Permission :: create ( $ this -> request -> all ( ) ) ; $ permission -> syncRoles ( $ this -> request -> get ( 'roles' , [ ] ) ) ; return redirect ( ) -> route ( 'administrator.permissions.index' ) ; }
Store a newly created permission.

@return \Illuminate\Http\RedirectResponse
Store a newly created permission .