mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
Fix ArgumentCountError on the TenantAssetsController (#894)
* Fix ArgumentCount exception on the TenantAssetsController when no `$path` is provided * CS * CS * Handle null case explicitly * code style Co-authored-by: Bram Wubs <bram@sibi.nl> Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
parent
ba928100e6
commit
747c192979
2 changed files with 20 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Controllers;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use Throwable;
|
||||
|
||||
class TenantAssetsController extends Controller
|
||||
{
|
||||
|
|
@ -15,11 +16,13 @@ class TenantAssetsController extends Controller
|
|||
$this->middleware(static::$tenancyMiddleware);
|
||||
}
|
||||
|
||||
public function asset($path)
|
||||
public function asset($path = null)
|
||||
{
|
||||
abort_if($path === null, 404);
|
||||
|
||||
try {
|
||||
return response()->file(storage_path("app/public/$path"));
|
||||
} catch (\Throwable $th) {
|
||||
} catch (Throwable $th) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue