Add files and updates necessary to manage new layout.

This commit is contained in:
James Cole
2022-02-27 10:04:08 +01:00
parent 3f61b6d707
commit aa7d4a610b
9 changed files with 106 additions and 45 deletions

View File

@@ -103,7 +103,7 @@ class HomeController extends Controller
public function index(AccountRepositoryInterface $repository): mixed
{
if ('v3' === config('firefly.layout')) {
die('Please set your layout to "v1".');
return view('pwa');
}
$types = config('firefly.accountTypesByIdentifier.asset');
$count = $repository->count($types);

View File

@@ -47,6 +47,7 @@ use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Laravel\Passport\Http\Middleware\CreateFreshApiToken;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
use PragmaRX\Google2FALaravel\Middleware as MFAMiddleware;
/**
@@ -177,9 +178,9 @@ class Kernel extends HttpKernel
CreateFreshApiToken::class,
],
'apiX' => [
'auth:api',
//'throttle:60,1',
'api' => [
EnsureFrontendRequestsAreStateful::class,
'auth:api,sanctum',
'bindings',
],
'apiY' => [

View File

@@ -26,6 +26,7 @@ use Adldap\Laravel\Middleware\WindowsAuthenticate;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Laravel\Passport\Passport;
use Laravel\Sanctum\Sanctum;
use URL;
/**
@@ -48,6 +49,7 @@ class AppServiceProvider extends ServiceProvider
if (config('ldap_auth.identifiers.windows.enabled', false)) {
$this->app['router']->pushMiddlewareToGroup('web', WindowsAuthenticate::class);
}
Sanctum::ignoreMigrations();
}
/**

View File

@@ -49,48 +49,25 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the routes for the application.
*/
public function map(): void
public function boot(): void
{
$this->mapApiRoutes();
$this->mapCronApiRoutes();
$this->mapWebRoutes();
$this->routes(function () {
Route::prefix('api/v1')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::prefix('api/v1/cron')
->middleware('apiY')
->namespace($this->namespace)
->group(base_path('routes/api-noauth.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::prefix('api/v1')
->middleware('apiX')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapCronApiRoutes(): void
{
Route::prefix('api/v1/cron')
->middleware('apiY')
->namespace($this->namespace)
->group(base_path('routes/api-noauth.php'));
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
}

View File

@@ -162,7 +162,7 @@ class User extends Authenticatable
use Notifiable, HasApiTokens;
/**
* The attributes that should be casted to native types.
* The attributes that should be cast to native types.
*
* @var array
*/