mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 10:54:04 +00:00
fix more files broken in automerge
This commit is contained in:
parent
56a6f25dac
commit
4b52fed4a0
4 changed files with 2 additions and 69 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- laravel: "10.0"
|
- laravel: "^10.0"
|
||||||
php: "8.2"
|
php: "8.2"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- name: Install Composer dependencies
|
||||||
run: |
|
run: |
|
||||||
composer require "laravel/framework:^${{ matrix.laravel }}.0" --no-interaction --no-update
|
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
|
||||||
composer update --prefer-dist --no-interaction
|
composer update --prefer-dist --no-interaction
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ./vendor/bin/pest
|
run: ./vendor/bin/pest
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,4 +13,3 @@ tenant-schema-test.dump
|
||||||
tests/Etc/tmp/queuetest.json
|
tests/Etc/tmp/queuetest.json
|
||||||
docker-compose.override.yml
|
docker-compose.override.yml
|
||||||
.php-cs-fixer.cache
|
.php-cs-fixer.cache
|
||||||
|
|
||||||
|
|
|
||||||
22
src/Vite.php
22
src/Vite.php
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Stancl\Tenancy;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Vite as BaseVite;
|
|
||||||
|
|
||||||
class Vite extends BaseVite // todo move to a different directory in v4
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Generate an asset path for the application.
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param bool|null $secure
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function assetPath($path, $secure = null)
|
|
||||||
{
|
|
||||||
return global_asset($path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -8,12 +8,10 @@ use Illuminate\Routing\Route;
|
||||||
use Stancl\Tenancy\Enums\RouteMode;
|
use Stancl\Tenancy\Enums\RouteMode;
|
||||||
use Stancl\Tenancy\Tests\Etc\Tenant;
|
use Stancl\Tenancy\Tests\Etc\Tenant;
|
||||||
use Illuminate\Contracts\Http\Kernel;
|
use Illuminate\Contracts\Http\Kernel;
|
||||||
use Stancl\Tenancy\Actions\CloneRoutesAsTenant;
|
|
||||||
use Stancl\Tenancy\Resolvers\PathTenantResolver;
|
use Stancl\Tenancy\Resolvers\PathTenantResolver;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use Illuminate\Support\Facades\Route as RouteFacade;
|
use Illuminate\Support\Facades\Route as RouteFacade;
|
||||||
use Stancl\Tenancy\Tests\Etc\HasMiddlewareController;
|
use Stancl\Tenancy\Tests\Etc\HasMiddlewareController;
|
||||||
use Stancl\Tenancy\Middleware\InitializeTenancyByPath;
|
|
||||||
use Stancl\Tenancy\Middleware\IdentificationMiddleware;
|
use Stancl\Tenancy\Middleware\IdentificationMiddleware;
|
||||||
use Stancl\Tenancy\Resolvers\RequestDataTenantResolver;
|
use Stancl\Tenancy\Resolvers\RequestDataTenantResolver;
|
||||||
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|
||||||
|
|
@ -417,46 +415,4 @@ class Controller extends BaseController
|
||||||
{
|
{
|
||||||
return tenant() ? 'Tenancy is initialized.' : 'Tenancy is not initialized.';
|
return tenant() ? 'Tenancy is initialized.' : 'Tenancy is not initialized.';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
|
||||||
public function universal_route_works_when_middleware_is_inserted_via_controller_middleware()
|
|
||||||
{
|
|
||||||
Route::middlewareGroup('universal', []);
|
|
||||||
config(['tenancy.features' => [UniversalRoutes::class]]);
|
|
||||||
|
|
||||||
Route::get('/foo', [UniversalRouteController::class, 'show']);
|
|
||||||
|
|
||||||
$this->get('http://localhost/foo')
|
|
||||||
->assertSuccessful()
|
|
||||||
->assertSee('Tenancy is not initialized.');
|
|
||||||
|
|
||||||
$tenant = Tenant::create([
|
|
||||||
'id' => 'acme',
|
|
||||||
]);
|
|
||||||
$tenant->domains()->create([
|
|
||||||
'domain' => 'acme.localhost',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->get('http://acme.localhost/foo')
|
|
||||||
->assertSuccessful()
|
|
||||||
->assertSee('Tenancy is initialized.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UniversalRouteController
|
|
||||||
{
|
|
||||||
public function getMiddleware()
|
|
||||||
{
|
|
||||||
return array_map(fn($middleware) => [
|
|
||||||
'middleware' => $middleware,
|
|
||||||
'options' => [],
|
|
||||||
], ['universal', InitializeTenancyByDomain::class]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show()
|
|
||||||
{
|
|
||||||
return tenancy()->initialized
|
|
||||||
? 'Tenancy is initialized.'
|
|
||||||
: 'Tenancy is not initialized.';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue