I want to give the admin the ability to build front end landing pages that are built the same except for some unique data pulled up on each page for different users when /id or eventually /username is entered at the end of the page URL.
domain/pagename
Would load the page with admin picture on it where {{picture}} is entered in blade file.
domain/pagename/id or domain/pagename/username
Would load the same page but with the users picture on it where {{picture}} is entered in blade file.
I need the admin to be able to build the pages their self with a page builder and not have to add routes for each page. So I need to know the best way to accomplish this so that all front end pages get this function automatically applied to all front end pages.
I'm new to Laravel and I really appreciate any assistance you can offer on this.
I'm starting off using code generated from an opensource GrapesJS page builder.
routes/frontend.php
use Illuminate\Support\Facades\Route;
use MSA\LaravelGrapes\Http\Controllers\FrontendController;
Route::get('pagename', [FrontendController::class, 'Page1']);
Route::get('page2name', [FrontendController::class, 'Page2']);
Http/Controllers/FrontendController.php
namespace MSA\LaravelGrapes\Http\Controllers;
use Illuminate\Http\Request;
use MSA\LaravelGrapes\Http\Controllers\Controller;
class FrontendController extends Controller
{
public function Page1()
{
return view('lg::pages/pagename');
}
public function Page2()
{
return view('lg::pages/page2name');
}
}