| Total Complexity | 2 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class InternalLinksController extends Controller |
||
| 11 | { |
||
| 12 | public function index(Request $request) |
||
| 13 | { |
||
| 14 | // Fetch the links for specific locale |
||
| 15 | if ($request->has('locale')) { |
||
| 16 | app()->setLocale($request->get('locale')); |
||
| 17 | } |
||
| 18 | |||
| 19 | $links = Page::all()->map(function ($page) { |
||
| 20 | return [ |
||
| 21 | 'name' => $page->menuLabel(), |
||
| 22 | 'url' => $page->url(), |
||
| 23 | ]; |
||
| 24 | }); |
||
| 25 | |||
| 26 | return response()->json($links->prepend(['name' => '...', 'url' => ''])->all()); |
||
| 27 | } |
||
| 29 |