Skip to content

Commit

Permalink
* remove route group web & commands then add api, like the remo…
Browse files Browse the repository at this point in the history
…ved `App\Providers\RouteServiceProvider` in previous commit 167599f @ `withRouting()`

* register the implement of `Illuminate\Contracts\Debug\ExceptionHandler` with `App\Exceptions\Handler`, partial revert 167599f @ `withSingletons()`
@ bootstrap/app.php

* partial revert 167599f @ config/{database,services}.php
- unused override methods @ `App\Exceptions\Handler`
- unused configs with the default value @ .env.example
$ rm storage/clockwork
@ be
  • Loading branch information
n0099 committed Jun 4, 2024
1 parent 3a711ec commit 5244487
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 93 deletions.
66 changes: 12 additions & 54 deletions be/.env.example
Original file line number Diff line number Diff line change
@@ -1,64 +1,22 @@
APP_NAME=Laravel
APP_ENV=local
APP_NAME=open-tbm
APP_ENV=production
APP_KEY=
APP_DEBUG=true
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
DB_CONNECTION=pgsql
# https://github.com/laravel/framework/issues/3987
DB_HOST=/var/run/postgresql
DB_PORT=5432
DB_SEARCH_PATH=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

VITE_APP_NAME="${APP_NAME}"
RECAPTCHA_SECRET=
22 changes: 0 additions & 22 deletions be/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,9 @@
namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}

/**
* Override parent method to replace validate fail redirect with global error info json format
*
Expand Down
6 changes: 4 additions & 2 deletions be/bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
api: __DIR__.'/../routes/api.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withSingletons([
Illuminate\Contracts\Debug\ExceptionHandler::class => App\Exceptions\Handler::class
])
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
2 changes: 1 addition & 1 deletion be/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'search_path' => env('DB_SEARCH_PATH', 'public'),
'sslmode' => 'prefer',
],

Expand Down
4 changes: 4 additions & 0 deletions be/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@
],
],

'recaptcha' => [
'secret' => env('RECAPTCHA_SECRET'),
],

];
11 changes: 0 additions & 11 deletions be/routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
use App\Http\Middleware\ReCAPTCHACheck;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::get('/forums', static fn () => \App\Eloquent\Model\Forum::all()->toJson());

Route::middleware(ReCAPTCHACheck::class)->group(static function () {
Expand Down
3 changes: 0 additions & 3 deletions be/storage/clockwork/.gitignore

This file was deleted.

Empty file removed be/storage/clockwork/index
Empty file.

0 comments on commit 5244487

Please sign in to comment.