mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 21:34:03 +00:00
Add identification section to config, refactor static properties
This commit is contained in:
parent
e5bc8ddb77
commit
ccaba05272
17 changed files with 153 additions and 97 deletions
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Controllers;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Throwable;
|
||||
|
||||
class TenantAssetsController extends Controller // todo rename this to TenantAssetController & update references in docs
|
||||
{
|
||||
public static string|array|Closure $tenancyMiddleware = \Stancl\Tenancy\Middleware\InitializeTenancyByDomain::class;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(static::$tenancyMiddleware);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public function asset(string $path = null): BinaryFileResponse
|
||||
{
|
||||
abort_if($path === null, 404);
|
||||
|
||||
try {
|
||||
return response()->file(storage_path("app/public/$path"));
|
||||
} catch (Throwable) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue