PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / trunk
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder vtrunk
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Http / Controllers / RolesController.php

RolesController.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder trunk, at app/Http/Controllers/RolesController.php

41 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Http\Controllers;
4
5 use FluentForm\Framework\Validator\ValidationException;
6 use FluentForm\App\Services\Roles\RolesService;
7
8 class RolesController extends Controller
9 {
10 public function index(RolesService $rolesService)
11 {
12 $attributes = $this->request->all();
13
14 $sanitizeMap = [
15 'search' => 'sanitize_text_field',
16 ];
17 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
18
19 $result = $rolesService->getRoles($attributes);
20 return $this->sendSuccess($result);
21 }
22
23 public function addCapability(RolesService $rolesService)
24 {
25 try {
26 $attributes = $this->request->all();
27
28 $sanitizeMap = [
29 'role' => 'sanitize_text_field',
30 'capability' => 'sanitize_text_field',
31 ];
32 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
33
34 $result = $rolesService->setCapability($attributes);
35 return $this->sendSuccess($result);
36 } catch (ValidationException $exception) {
37 return $this->sendError($exception->errors(), 422);
38 }
39 }
40 }
41