#1 - project skeleton

This commit is contained in:
Adrian Hopek
2022-01-10 12:19:04 +01:00
parent 683b2367ea
commit d4f522f9d8
90 changed files with 25978 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Toby\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
}

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace Toby\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
protected $policies = [];
public function boot(): void
{
$this->registerPolicies();
}
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Toby\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
protected $listen = [];
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Toby\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
public const HOME = "/home";
public function boot(): void
{
$this->configureRateLimiting();
$this->routes(function (): void {
Route::prefix("api")
->middleware("api")
->group(base_path("routes/api.php"));
Route::middleware("web")
->group(base_path("routes/web.php"));
});
}
protected function configureRateLimiting(): void
{
RateLimiter::for("api", fn(Request $request) => Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()));
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace Toby\Providers;
use Illuminate\Support\ServiceProvider;
use Laravel\Telescope\TelescopeApplicationServiceProvider;
use Laravel\Telescope\TelescopeServiceProvider as BaseTelescopeServiceProvider;
class TelescopeServiceProvider extends ServiceProvider
{
public function register(): void
{
if ($this->app->environment("local")) {
$this->app->register(BaseTelescopeServiceProvider::class);
$this->app->register(TelescopeApplicationServiceProvider::class);
}
}
}