public function putMap(): array
    {
        $auth = $this->auth;
        return [
            ['PUT', '/Navigation/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 2, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No navigation link found");
                }
                $navigation = Model\Navigation::find($id);
                if ($navigation === null) {
                    throw new \DomainException("No navigation link found");
                }
                if (isset($request['class']) === true && $request['class'] === '') {
                    unset($request['class']);
                }
                if (isset($request['link']) === true && $request['link'] === '') {
                    unset($request['link']);
                }
                if (isset($request['navigation_id']) === true && ($request['navigation_id'] === '' || $request['navigation_id'] == $id)) {
                    unset($request['navigation_id']);
                }
                $validator = new \Valitron\Validator($request);
                $validator->rule('required', ['title']);
                $validator->rule('optional', ['class', 'link', 'navigation_id']);
                $validator->rule('url', 'link');
                $validator->rule(function ($field, $value, $params, $fields) {
                    if (is_array($value) === true || preg_match('/[\w\-]+(,\s?[\w\-]+)*/', $value) === 1) {
                        return true;
                    }
                    return false;
                }, "class")->message("{field} must be an array or comma-separated");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $navigation = Model\Navigation::find($value);
                    if ($navigation === null) {
                        return false;
                    }
                    return true;
                }, "navigation_id")->message("{field} must be child of a valid navigation link");
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                $navigation->title = $request['title'];
                if ($navigation->page_id === null && isset($request['link']) === true) {
                    $navigation->link = $request['link'];
                } else {
                    $navigation->link = null;
                }
                if (isset($request['class']) === true) {
                    if (is_string($request['class']) === true) {
                        $request['class'] = explode(",", $request['class']);
                        foreach ($request['class'] as $key => $class) {
                            $request['class'][$key] = trim($class);
                        }
                    }
                    $navigation->class = $request['class'];
                } else {
                    $navigation->class = null;
                }
                if (isset($request['navigation_id']) === true) {
                    $navigation->navigation_id = $request['navigation_id'];
                } else {
                    $navigation->navigation_id = null;
                }
                $navigation->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['PUT', '/Page/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No page found");
                }
                $page = Model\Page::where("id", $id);
                if ($auth->allow(["min" => 2, "max" => 2]) === false
                    && $auth->allow(["min" => 3, "max" => 3]) === true) {
                    $page->where('user_id', $this->auth->details->id);
                }
                $page = $page->first();
                if ($page === null) {
                    throw new \DomainException("No page found");
                }
                if (isset($request['byline']) === true && $request['byline'] === '') {
                    unset($request['byline']);
                }
                if (isset($request['content']) === true && $request['content'] === '') {
                    unset($request['content']);
                }
                if ((isset($request['link']) === true && $request['link'] === '') || $page->id == 1) {
                    unset($request['link']);
                }
                if (isset($request['featured']) === true && $request['featured'] === '') {
                    unset($request['featured']);
                }
                if (isset($request['tags']) === true && $request['tags'] === '') {
                    unset($request['tags']);
                }
                if (isset($request['class']) === true && $request['class'] === '') {
                    unset($request['class']);
                }
                if (isset($request['template']) === true && $request['template'] === '') {
                    unset($request['template']);
                }
                if (isset($request['status']) === true && $request['status'] === '') {
                    unset($request['status']);
                }
                if (isset($request['page_id']) === true && ($request['page_id'] === '' || $request['page_id'] == $id)) {
                    unset($request['page_id']);
                }
                $validator = new \Valitron\Validator($request);
                $validator->rule('required', ['title']);
                $validator->rule('optional', ['byline', 'content', 'link', 'featured', 'tags', 'class', 'template', 'status', 'page_id']);
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return is_string($value);
                }, ['title', 'byline', 'content', 'template'])->message("{field} must be a string");
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return is_bool($value) || in_array($value, [0, 1]);
                }, 'status');
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return file_exists(rtrim(public_path(), '/') . $value) || (filter_var($value, FILTER_VALIDATE_URL) !== false);
                }, 'featured')->message('{field} must be an external link or a local file path');
                $validator->rule(function ($field, $value, $params, $fields) {
                    if (is_array($value) === true || preg_match('/[\w\-]+(,\s?[\w\-]+)*/', $value) === 1) {
                        return true;
                    }
                    return false;
                }, ["tags", "class"])->message("{field} must be an array or comma-separated");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $page = Model\Page::find($value);
                    if ($page === null) {
                        return false;
                    }
                    return true;
                }, "page_id")->message("{field} must be child of a valid page");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $page = Model\Page::withTrashed()->where('link', $value)->first();
                    if ($page === null) {
                        return true;
                    }
                    return false;
                }, "link")->message("{field} must be unique");
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                $page->title = $request['title'];
                if (isset($request['byline']) === true) {
                    $page->byline = $request['byline'];
                } else {
                    $page->byline = null;
                }
                if (isset($request['content']) === true) {
                    $page->content = $request['content'];
                } else {
                    $page->content = null;
                }
                if (isset($request['featured']) === true) {
                    $page->featured = $request['featured'];
                } else {
                    $page->featured = null;
                }
                if (isset($request['tags']) === true) {
                    if (is_string($request['tags']) === true) {
                        $request['tags'] = explode(",", $request['tags']);
                        foreach ($request['tags'] as $key => $tags) {
                            $request['tags'][$key] = trim($tags);
                        }
                    }
                    $page->tags = $request['tags'];
                } else {
                    $page->tags = [];
                }
                if (isset($request['class']) === true) {
                    if (is_string($request['class']) === true) {
                        $request['class'] = explode(",", $request['class']);
                        foreach ($request['class'] as $key => $class) {
                            $request['class'][$key] = trim($class);
                        }
                    }
                    $page->class = $request['class'];
                } else {
                    $page->class = [];
                }
                if (isset($request['template']) === true) {
                    $page->template = $request['template'];
                } else {
                    $page->template = 'default';
                }
                if (isset($request['link']) === true && $page->id != 1) {
                    $page->link = $request['link'];
                } elseif ($page->id != 1) {
                    $page->link = '/' . slugify($page->title);
                    $i = 1;
                    $page_test = Model\Page::withTrashed()->where("link", $page->link)->first();
                    while ($page_test != null && $page_test->id != $page->id) {
                        $i ++;
                        $page->link = '/' . slugify($page->title) . '-' . $i;
                    }
                }
                $page->link = '/' . trim($page->link, "/");
                if (isset($request['status']) === true) {
                    $page->status = (bool) $request['status'];
                } else {
                    $page->status = false;
                }
                if (isset($request['page_id']) === true) {
                    $page->page_id = $request['page_id'];
                } else {
                    $page->page_id = null;
                }
                $page->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['PUT', '/Setting/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 1, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No setting found");
                }
                $setting = Model\Setting::find($id);
                if ($setting === null) {
                    throw new \DomainException("No setting found");
                }
                $validator = new \Valitron\Validator($request);
                $name = '';
                if ($id == 1) {
                    $name = 'Site enabled';
                } elseif($id == 2) {
                    $name = 'Site title';
                } elseif($id == 3) {
                    $name = 'Site description';
                } elseif($id == 3) {
                    $name = 'Site email';
                } elseif($id == 3) {
                    $name = 'Site logo';
                }
                $validator->rule('required', 'value')->message($name . ' is required');
                if ($setting->id == 1) {
                    $validator->rule(function ($field, $value, array $params, array $fields) {
                        return is_bool($value) || in_array($value, [0, 1]);
                    }, 'value')->message($name . ' must be yes or no');
                } elseif ($setting->id == 4) {
                    $validator->rule('email', 'value')->message($name . ' must be valid');
                } elseif ($setting->id == 5) {
                    $validator->rule(function ($field, $value, array $params, array $fields) {
                        return file_exists(rtrim(public_path(), '/') . $value) || (filter_var($value, FILTER_VALIDATE_URL) !== false);
                    }, 'value')->message($name . ' must be an external link or a local file path');
                }
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                if ($setting->id == 1) {
                    $setting->value = (bool) $request['value'];
                } else {
                    $setting->value = $request['value'];
                }
                $setting->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }]
        ];
    }
public function putMap(): array
    {
        $auth = $this->auth;
        return [
            ['PUT', '/Navigation/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 2, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No navigation link found");
                }
                $navigation = Model\Navigation::find($id);
                if ($navigation === null) {
                    throw new \DomainException("No navigation link found");
                }
                if (isset($request['class']) === true && $request['class'] === '') {
                    unset($request['class']);
                }
                if (isset($request['link']) === true && $request['link'] === '') {
                    unset($request['link']);
                }
                if (isset($request['navigation_id']) === true && ($request['navigation_id'] === '' || $request['navigation_id'] == $id)) {
                    unset($request['navigation_id']);
                }
                $validator = new \Valitron\Validator($request);
                $validator->rule('required', ['title']);
                $validator->rule('optional', ['class', 'link', 'navigation_id']);
                $validator->rule('url', 'link');
                $validator->rule(function ($field, $value, $params, $fields) {
                    if (is_array($value) === true || preg_match('/[\w\-]+(,\s?[\w\-]+)*/', $value) === 1) {
                        return true;
                    }
                    return false;
                }, "class")->message("{field} must be an array or comma-separated");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $navigation = Model\Navigation::find($value);
                    if ($navigation === null) {
                        return false;
                    }
                    return true;
                }, "navigation_id")->message("{field} must be child of a valid navigation link");
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                $navigation->title = $request['title'];
                if ($navigation->page_id === null && isset($request['link']) === true) {
                    $navigation->link = $request['link'];
                } else {
                    $navigation->link = null;
                }
                if (isset($request['class']) === true) {
                    if (is_string($request['class']) === true) {
                        $request['class'] = explode(",", $request['class']);
                        foreach ($request['class'] as $key => $class) {
                            $request['class'][$key] = trim($class);
                        }
                    }
                    $navigation->class = $request['class'];
                } else {
                    $navigation->class = null;
                }
                if (isset($request['navigation_id']) === true) {
                    $navigation->navigation_id = $request['navigation_id'];
                } else {
                    $navigation->navigation_id = null;
                }
                $navigation->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['PUT', '/Page/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 3, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No page found");
                }
                $page = Model\Page::where("id", $id);
                if ($auth->allow(["min" => 2, "max" => 2]) === false
                    && $auth->allow(["min" => 3, "max" => 3]) === true) {
                    $page->where('user_id', $this->auth->details->id);
                }
                $page = $page->first();
                if ($page === null) {
                    throw new \DomainException("No page found");
                }
                if (isset($request['byline']) === true && $request['byline'] === '') {
                    unset($request['byline']);
                }
                if (isset($request['content']) === true && $request['content'] === '') {
                    unset($request['content']);
                }
                if ((isset($request['link']) === true && $request['link'] === '') || $page->id == 1) {
                    unset($request['link']);
                }
                if (isset($request['featured']) === true && $request['featured'] === '') {
                    unset($request['featured']);
                }
                if (isset($request['tags']) === true && $request['tags'] === '') {
                    unset($request['tags']);
                }
                if (isset($request['class']) === true && $request['class'] === '') {
                    unset($request['class']);
                }
                if (isset($request['template']) === true && $request['template'] === '') {
                    unset($request['template']);
                }
                if (isset($request['status']) === true && $request['status'] === '') {
                    unset($request['status']);
                }
                if (isset($request['page_id']) === true && ($request['page_id'] === '' || $request['page_id'] == $id)) {
                    unset($request['page_id']);
                }
                $validator = new \Valitron\Validator($request);
                $validator->rule('required', ['title']);
                $validator->rule('optional', ['byline', 'content', 'link', 'featured', 'tags', 'class', 'template', 'status', 'page_id']);
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return is_string($value);
                }, ['title', 'byline', 'content', 'template'])->message("{field} must be a string");
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return is_bool($value) || in_array($value, [0, 1]);
                }, 'status');
                $validator->rule(function ($field, $value, array $params, array $fields) {
                    return file_exists(rtrim(public_path(), '/') . $value) || (filter_var($value, FILTER_VALIDATE_URL) !== false);
                }, 'featured')->message('{field} must be an external link or a local file path');
                $validator->rule(function ($field, $value, $params, $fields) {
                    if (is_array($value) === true || preg_match('/[\w\-]+(,\s?[\w\-]+)*/', $value) === 1) {
                        return true;
                    }
                    return false;
                }, ["tags", "class"])->message("{field} must be an array or comma-separated");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $page = Model\Page::find($value);
                    if ($page === null) {
                        return false;
                    }
                    return true;
                }, "page_id")->message("{field} must be child of a valid page");
                $validator->rule(function ($field, $value, $params, $fields) {
                    $page = Model\Page::withTrashed()->where('link', $value)->first();
                    if ($page === null) {
                        return true;
                    }
                    return false;
                }, "link")->message("{field} must be unique");
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                $page->title = $request['title'];
                if (isset($request['byline']) === true) {
                    $page->byline = $request['byline'];
                } else {
                    $page->byline = null;
                }
                if (isset($request['content']) === true) {
                    $page->content = $request['content'];
                } else {
                    $page->content = null;
                }
                if (isset($request['featured']) === true) {
                    $page->featured = $request['featured'];
                } else {
                    $page->featured = null;
                }
                if (isset($request['tags']) === true) {
                    if (is_string($request['tags']) === true) {
                        $request['tags'] = explode(",", $request['tags']);
                        foreach ($request['tags'] as $key => $tags) {
                            $request['tags'][$key] = trim($tags);
                        }
                    }
                    $page->tags = $request['tags'];
                } else {
                    $page->tags = [];
                }
                if (isset($request['class']) === true) {
                    if (is_string($request['class']) === true) {
                        $request['class'] = explode(",", $request['class']);
                        foreach ($request['class'] as $key => $class) {
                            $request['class'][$key] = trim($class);
                        }
                    }
                    $page->class = $request['class'];
                } else {
                    $page->class = [];
                }
                if (isset($request['template']) === true) {
                    $page->template = $request['template'];
                } else {
                    $page->template = 'default';
                }
                if (isset($request['link']) === true && $page->id != 1) {
                    $page->link = $request['link'];
                } elseif ($page->id != 1) {
                    $page->link = '/' . slugify($page->title);
                    $i = 1;
                    $page_test = Model\Page::withTrashed()->where("link", $page->link)->first();
                    while ($page_test != null && $page_test->id != $page->id) {
                        $i ++;
                        $page->link = '/' . slugify($page->title) . '-' . $i;
                    }
                }
                $page->link = '/' . trim($page->link, "/");
                if (isset($request['status']) === true) {
                    $page->status = (bool) $request['status'];
                } else {
                    $page->status = false;
                }
                if (isset($request['page_id']) === true) {
                    $page->page_id = $request['page_id'];
                } else {
                    $page->page_id = null;
                }
                $page->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }],
            ['PUT', '/Setting/[i:id]', function (int $id = null, array $request) use ($auth) {
                if ($auth->allow(["min" => 1, "max" => 1]) === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 401',
                                true,
                                401
                            ]
                        ],
                        "response" => "Not logged in with proper credentials"
                    ];
                }
                if (isset($id) === false) {
                    throw new \InvalidArgumentException("No setting found");
                }
                $setting = Model\Setting::find($id);
                if ($setting === null) {
                    throw new \DomainException("No setting found");
                }
                $validator = new \Valitron\Validator($request);
                $name = '';
                if ($id == 1) {
                    $name = 'Site enabled';
                } elseif($id == 2) {
                    $name = 'Site title';
                } elseif($id == 3) {
                    $name = 'Site description';
                } elseif($id == 3) {
                    $name = 'Site email';
                } elseif($id == 3) {
                    $name = 'Site logo';
                }
                $validator->rule('required', 'value')->message($name . ' is required');
                if ($setting->id == 1) {
                    $validator->rule(function ($field, $value, array $params, array $fields) {
                        return is_bool($value) || in_array($value, [0, 1]);
                    }, 'value')->message($name . ' must be yes or no');
                } elseif ($setting->id == 4) {
                    $validator->rule('email', 'value')->message($name . ' must be valid');
                } elseif ($setting->id == 5) {
                    $validator->rule(function ($field, $value, array $params, array $fields) {
                        return file_exists(rtrim(public_path(), '/') . $value) || (filter_var($value, FILTER_VALIDATE_URL) !== false);
                    }, 'value')->message($name . ' must be an external link or a local file path');
                }
                if ($validator->validate() === false) {
                    return [
                        "headers" => [
                            [
                                'X-PHP-Response-Code: 422',
                                true,
                                422
                            ]
                        ],
                        "response" => $validator->errors()
                    ];
                }
                if ($setting->id == 1) {
                    $setting->value = (bool) $request['value'];
                } else {
                    $setting->value = $request['value'];
                }
                $setting->save();
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 200',
                            true,
                            200
                        ]
                    ],
                    "response" => true
                ];
            }]
        ];
    }
Returns the request map for PUT requests

@return array