public function index() { Audit::log(Auth::user()->id, trans('admin/settings/general.audit-log.category'), trans('admin/settings/general.audit-log.msg-index')); $page_title = trans('admin/settings/general.page.index.title'); // "Admin | Settings"; $page_description = trans('admin/settings/general.page.index.description'); // "List of Settings"; // $settings = (new SettingModel())->all(); $settings = Setting::all(); $settings = Arr::dot($settings); $settingsFiltered = Utils::FilterOutUserSettings($settings); $settingsFiltered = Arr::sortRecursive($settingsFiltered); return view('admin.settings.index', compact('settingsFiltered', 'page_title', 'page_description')); }
/** * Recursively sort an array by keys and values. * * @param array $array * @return array */ function array_sort_recursive($array) { return Arr::sortRecursive($array); }
/** * Assert that the response contains the given JSON. * * @param array $data * @param bool $negate * @return $this */ protected function seeJsonContains(array $data, $negate = false) { $method = $negate ? 'assertFalse' : 'assertTrue'; $actual = json_encode(Arr::sortRecursive((array) $this->decodeResponseJson())); foreach (Arr::sortRecursive($data) as $key => $value) { $expected = $this->formatToExpectedJson($key, $value); $this->{$method}(Str::contains($actual, $expected), ($negate ? 'Found unexpected' : 'Unable to find') . ' JSON fragment' . PHP_EOL . "[{$expected}]" . PHP_EOL . 'within' . PHP_EOL . "[{$actual}]."); } return $this; }
/** * Assert that the response contains the given JSON. * * @param array $data * @param bool $negate * @return $this */ protected function seeJsonContains(array $data, $negate = false) { $method = $negate ? 'assertFalse' : 'assertTrue'; $actual = json_decode($this->response->getContent(), true); if (is_null($actual) || $actual === false) { return $this->fail('Invalid JSON was returned from the route. Perhaps an exception was thrown?'); } $actual = json_encode(Arr::sortRecursive((array) $actual)); foreach (Arr::sortRecursive($data) as $key => $value) { $expected = $this->formatToExpectedJson($key, $value); $this->{$method}(Str::contains($actual, $expected), ($negate ? 'Found unexpected' : 'Unable to find') . " JSON fragment [{$expected}] within [{$actual}]."); } return $this; }