Skip to content

Commit

Permalink
feat: api setup (#3)
Browse files Browse the repository at this point in the history
* chore: breeze installation

* feat: todo entity and migration

* chore: install api platform

* feat: api endpoint for todo model

* feat: todo seeder

* chore: sanctum

* style: format
  • Loading branch information
fuzoh authored Jan 16, 2025
1 parent c61960b commit 64a4b4b
Show file tree
Hide file tree
Showing 137 changed files with 109,767 additions and 3,910 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/no-unescaped-entities": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ yarn-error.log
/.nova
/.vscode
/.zed

**/caddy
frankenphp
frankenphp-worker.php
2,837 changes: 2,837 additions & 0 deletions .phpstorm.meta.php

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"plugins": [
"prettier-plugin-organize-imports",
"prettier-plugin-tailwindcss"
]
}
225 changes: 225 additions & 0 deletions _ide_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22304,6 +22304,161 @@ public static function flushMacros()
}
}

namespace Laravel\Octane\Facades {
/**
*
*
* @see \Laravel\Octane\Octane
*/
class Octane {
/**
* Get a Swoole table instance.
*
* @static
*/
public static function table($table)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->table($table);
}

/**
* Format an exception to a string that should be returned to the client.
*
* @static
*/
public static function formatExceptionForClient($e, $debug = false)
{
return \Laravel\Octane\Octane::formatExceptionForClient($e, $debug);
}

/**
* Write an error message to STDERR or to the SAPI logger if not in CLI mode.
*
* @static
*/
public static function writeError($message)
{
return \Laravel\Octane\Octane::writeError($message);
}

/**
* Concurrently resolve the given callbacks via background tasks, returning the results.
*
* Results will be keyed by their given keys - if a task did not finish, the tasks value will be "false".
*
* @return array
* @throws \Laravel\Octane\Exceptions\TaskException
* @throws \Laravel\Octane\Exceptions\TaskTimeoutException
* @static
*/
public static function concurrently($tasks, $waitMilliseconds = 3000)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->concurrently($tasks, $waitMilliseconds);
}

/**
* Get the task dispatcher.
*
* @return \Laravel\Octane\Contracts\DispatchesTasks
* @static
*/
public static function tasks()
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->tasks();
}

/**
* Get the listeners that will prepare the Laravel application for a new request.
*
* @static
*/
public static function prepareApplicationForNextRequest()
{
return \Laravel\Octane\Octane::prepareApplicationForNextRequest();
}

/**
* Get the listeners that will prepare the Laravel application for a new operation.
*
* @static
*/
public static function prepareApplicationForNextOperation()
{
return \Laravel\Octane\Octane::prepareApplicationForNextOperation();
}

/**
* Get the container bindings / services that should be pre-resolved by default.
*
* @static
*/
public static function defaultServicesToWarm()
{
return \Laravel\Octane\Octane::defaultServicesToWarm();
}

/**
* Register a Octane route.
*
* @static
*/
public static function route($method, $uri, $callback)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->route($method, $uri, $callback);
}

/**
* Determine if a route exists for the given method and URI.
*
* @static
*/
public static function hasRouteFor($method, $uri)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->hasRouteFor($method, $uri);
}

/**
* Invoke the route for the given method and URI.
*
* @static
*/
public static function invokeRoute($request, $method, $uri)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->invokeRoute($request, $method, $uri);
}

/**
* Get the registered Octane routes.
*
* @static
*/
public static function getRoutes()
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->getRoutes();
}

/**
* Register a callback to be called every N seconds.
*
* @return \Laravel\Octane\Swoole\InvokeTickCallable
* @static
*/
public static function tick($key, $callback, $seconds = 1, $immediate = true)
{
/** @var \Laravel\Octane\Octane $instance */
return $instance->tick($key, $callback, $seconds, $immediate);
}

}
}

namespace Illuminate\Http {
/**
*
Expand Down Expand Up @@ -22385,6 +22540,75 @@ public static function hasValidRelativeSignatureWhileIgnoring($ignoreQuery = [])
return \Illuminate\Http\Request::hasValidRelativeSignatureWhileIgnoring($ignoreQuery);
}

/**
*
*
* @see \Inertia\ServiceProvider::registerRequestMacro()
* @static
*/
public static function inertia()
{
return \Illuminate\Http\Request::inertia();
}

}
}

namespace Illuminate\Routing {
/**
*
*
* @mixin \Illuminate\Routing\RouteRegistrar
*/
class Router {
/**
*
*
* @see \Inertia\ServiceProvider::registerRouterMacro()
* @param mixed $uri
* @param mixed $component
* @param mixed $props
* @static
*/
public static function inertia($uri, $component, $props = [])
{
return \Illuminate\Routing\Router::inertia($uri, $component, $props);
}

}
}

namespace Illuminate\Testing {
/**
*
*
* @template TResponse of \Symfony\Component\HttpFoundation\Response
* @mixin \Illuminate\Http\Response
*/
class TestResponse {
/**
*
*
* @see \Inertia\Testing\TestResponseMacros::assertInertia()
* @param \Closure|null $callback
* @static
*/
public static function assertInertia($callback = null)
{
return \Illuminate\Testing\TestResponse::assertInertia($callback);
}

/**
*
*
* @see \Inertia\Testing\TestResponseMacros::inertiaPage()
* @static
*/
public static function inertiaPage()
{
return \Illuminate\Testing\TestResponse::inertiaPage();
}

}
}

Expand Down Expand Up @@ -26748,6 +26972,7 @@ class Uri extends \Illuminate\Support\Uri {}
class Validator extends \Illuminate\Support\Facades\Validator {}
class View extends \Illuminate\Support\Facades\View {}
class Vite extends \Illuminate\Support\Facades\Vite {}
class Octane extends \Laravel\Octane\Facades\Octane {}
}


Expand Down
52 changes: 52 additions & 0 deletions app/Http/Controllers/Auth/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
use Inertia\Response;

class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): Response
{
return Inertia::render('Auth/Login', [
'canResetPassword' => Route::has('password.request'),
'status' => session('status'),
]);
}

/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();

$request->session()->regenerate();

return redirect()->intended(route('dashboard', absolute: false));
}

/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();

$request->session()->invalidate();

$request->session()->regenerateToken();

return redirect('/');
}
}
41 changes: 41 additions & 0 deletions app/Http/Controllers/Auth/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Inertia\Inertia;
use Inertia\Response;

class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*/
public function show(): Response
{
return Inertia::render('Auth/ConfirmPassword');
}

/**
* Confirm the user's password.
*/
public function store(Request $request): RedirectResponse
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}

$request->session()->put('auth.password_confirmed_at', time());

return redirect()->intended(route('dashboard', absolute: false));
}
}
Loading

0 comments on commit 64a4b4b

Please sign in to comment.