Skip to content

Commit 25c7787

Browse files
committed
playground: Add PlaygroundController and corresponding route for playground page
1 parent d88d431 commit 25c7787

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Inertia\Inertia;
7+
8+
class PlaygroundController extends Controller
9+
{
10+
/**
11+
* Handle the incoming request.
12+
*/
13+
public function __invoke(Request $request)
14+
{
15+
return Inertia::render('playground/index', [
16+
'data' => [],
17+
]);
18+
}
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import AppLayout from '@/layouts/app-layout';
2+
import AuthLayout from '@/layouts/auth-layout';
3+
4+
type Props = PageProps<{
5+
data: unknown;
6+
}>;
7+
8+
function Index({ data, user }: Props) {
9+
const Layout = user ? AppLayout : AuthLayout;
10+
11+
return (
12+
<Layout
13+
title="Playground"
14+
description="Playground for testing and experimenting with features"
15+
>
16+
<pre>{JSON.stringify(data, null, 2)}</pre>
17+
</Layout>
18+
);
19+
}
20+
21+
export default Index;

routes/web.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<?php
22

3+
use App\Http\Controllers\PlaygroundController;
34
use Illuminate\Support\Facades\Route;
45
use Inertia\Inertia;
56

7+
if (config('app.debug')) {
8+
Route::get('playground', PlaygroundController::class)->name('playground');
9+
}
10+
611
Route::get('/', function () {
712
return Inertia::render('welcome');
813
})->name('home');

0 commit comments

Comments
 (0)