<?php

use App\Http\Controllers\Frontend\PageController;
use App\Http\Controllers\ProfileController;
use App\Models\Page;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

$page = Page::pluck('permalink');


foreach ($page as $key => $url) {
    Route::get($url, [PageController::class, 'index']);
}
Route::get('service-view/{id}', [PageController::class, 'serviceView'])->name('service-view');


Route::get('/dashboard', function () {
    return view('backend.dashboard');
})->middleware(['auth'])->name('dashboard');


require __DIR__ . '/auth.php';
require __DIR__ . '/admin.php';