Remove Stripe/Cashier subscription billing, demo mode, and APP_MODE enum/helpers. Delete frontend-old/ and stale bin scripts. Adopt AGPL-3.0 (LICENSE.md, README, composer.json). Point Docker image, prod scripts, and README at forge.lvl0.xyz/lvl0/dishplanner.
54 lines
1.8 KiB
PHP
Executable file
54 lines
1.8 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Exceptions\CustomException;
|
|
use App\Models\Dish;
|
|
use App\Models\Schedule;
|
|
use App\Models\ScheduledUserDish;
|
|
use App\Models\User;
|
|
use App\Models\UserDish;
|
|
use DishPlanner\Dish\Policies\DishPolicy;
|
|
use DishPlanner\Schedule\Policies\SchedulePolicy;
|
|
use DishPlanner\ScheduledUserDish\Policies\ScheduledUserDishPolicy;
|
|
use DishPlanner\User\Policies\UserPolicy;
|
|
use DishPlanner\UserDish\Policies\UserDishPolicy;
|
|
use Illuminate\Contracts\Debug\ExceptionHandler;
|
|
use Illuminate\Foundation\Exceptions\Handler as BaseHandler;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Throwable;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(ExceptionHandler::class, function ($app) {
|
|
return new class($app) extends BaseHandler {
|
|
public function render($request, Throwable $e)
|
|
{
|
|
// Handle specific custom exception
|
|
if ($e instanceof CustomException) {
|
|
return response()->json([
|
|
'success' => false,
|
|
'payload' => null,
|
|
'errors' => [$e->getMessage()],
|
|
], $e->getCode() ?? 500);
|
|
}
|
|
|
|
return parent::render($request, $e);
|
|
}
|
|
};
|
|
});
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
Gate::policy(Dish::class, DishPolicy::class);
|
|
Gate::policy(Schedule::class, SchedulePolicy::class);
|
|
Gate::policy(ScheduledUserDish::class, ScheduledUserDishPolicy::class);
|
|
Gate::policy(User::class, UserPolicy::class);
|
|
Gate::policy(UserDish::class, UserDishPolicy::class);
|
|
}
|
|
}
|