Skip to content

Commit 2987cf6

Browse files
committed
feat(controller): Add AppController for SPA rendering
- Created AppController to handle SPA rendering logic. - Updated routes to use AppController for fallback rendering of the app view.
1 parent 08187a5 commit 2987cf6

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
class AppController extends Controller
8+
{
9+
/**
10+
* Handle the SPA rendering
11+
*
12+
* @return \Illuminate\View\View
13+
*/
14+
public function index()
15+
{
16+
// Here you can add your library logic to get data
17+
// $data = YourLibrary::getData();
18+
19+
return view('app');
20+
}
21+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
22

33
use Illuminate\Support\Facades\Route;
4+
use App\Http\Controllers\AppController;
45

56
// Catch-all route for rendering all paths with the same view
6-
Route::fallback(function () {
7-
return view('app');
8-
});
7+
Route::fallback([AppController::class, 'index']);

0 commit comments

Comments
 (0)