Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Raza9798 committed Sep 27, 2024
1 parent 195c4fe commit 6d0855d
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 5 deletions.
89 changes: 89 additions & 0 deletions app/Http/Controllers/WebRenderController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\GuestLayoutManagment;
use App\Models\Menu;

class WebRenderController extends Controller
{
public $contents;

public function __construct(Request $request)
{
$this->contents = $this->getModules($request->path());
}

public function getModules($url){
$menu = Menu::where('url', $url)->first();
$contents = GuestLayoutManagment::where('fk_menu_id', $menu->id)->get()->toArray();
if ($contents) {
$elements = [];
foreach ($contents as $content) {
if($content['is_active'] != 0) {
$elements[$content['sort_order']] = $content;
}
}
}
return $elements ?? [];
}

/**
* Display a listing of the resource.
*/
public function index()
{
return view('livewire.webrender', [
'contents' => $this->contents
]);
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
8 changes: 4 additions & 4 deletions database/seeders/GuestLayoutManagmentSeeder.php

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/build/assets/app-gyuvcUs_.css

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use App\Http\Controllers\WebRenderController;
use App\Http\Livewire\Homepage;
use App\Livewire\About;
use App\Livewire\Contact;
Expand All @@ -17,4 +19,4 @@
*/

Route::get('/', Webrender::class);
Route::get('/{dynamicUrl}', Webrender::class);
Route::get('/{dynamicUrl}', [WebRenderController::class, 'index']);
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import laravel from 'laravel-vite-plugin';
import { viteStaticCopy } from "vite-plugin-static-copy";

export default defineConfig({
base: '/',
plugins: [
laravel({
input: [
Expand Down

0 comments on commit 6d0855d

Please sign in to comment.