-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for third-party packages #98
Comments
LivewireI've looked into this briefly and found the following:
I need to find out:
|
FilamentI've also looked briefly into Filament and found the following:
Things to do:
|
TelescopeLooking into Laravel Telescope, I've discovered the following:
I need to:
|
Livewire Cont...Update RouteSince it is possible to dynamically set the Livewire update route, a route needs to be created during the tenancy setup phase, which adds a route parameter. By default, this should be the An example implementation of a Livewire service override is as follows. namespace App;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Livewire\Mechanisms\HandleRequests\HandleRequests;
use Sprout\Contracts\IdentityResolver;
use Sprout\Contracts\Tenancy;
use Sprout\Contracts\Tenant;
use Sprout\Overrides\BaseOverride;
class LivewireOverride extends BaseOverride
{
public function setup(Tenancy $tenancy, Tenant $tenant): void
{
$resolver = $this->getResolverForLivewire();
// We need to call setup so that the URL generator can be updated
// with default parameters for the tenant.
$resolver->setup($tenancy, $tenant);
$this->getApp()
->make(HandleRequests::class)
->setUpdateRoute(function (array $handler) use ($tenancy, $resolver) {
$route = null;
// We won't use the helper here, and we'll use the resolver
// directly to ensure that the route is created with the
// correct URL parameters.
$resolver->routes(
$this->getApp()->make(Router::class),
static function () use ($handler, &$route) {
$route = Route::name('sprout.livewire.update')
->post('/livewire/update/', $handler);
},
$tenancy
);
return $route;
});
}
protected function getResolverForLivewire(): IdentityResolver
{
return $this->getSprout()
->resolvers()
->get($this->config['resolver'] ?? 'path');
}
} File UploadThe disk to use for upload needs to be set via the config option The class that sets all this up is It looks like the best solution is to redefine the already existing routes when defining the update route for the // Create the upload and preview routes
Route::name('livewire.upload-file')
->post('/livewire/upload-file', [FileUploadController::class, 'handle']);
Route::name('livewire.preview-file')
->get('/livewire/preview-file/{filename}', [FilePreviewController::class, 'handle']); As for the filesystem handling, it looks like the only solution to that is a hacky workaround using composers autoload classmap, to map to a fake Sprout controlled version of |
Filament Cont...To override filament, there are two options.
public function configurePackage(Package $package): void
{
$package
->name('filament-panels')
->hasCommands($this->getCommands())
->hasRoutes('web')
->hasTranslations()
->hasViews();
}
|
FortifyTo make Fortify multitenanted, the automatic routing needs to be disabled by setting Route::tenanted(function () {
Route::group([
'namespace' => 'Laravel\Fortify\Http\Controllers',
'domain' => config('fortify.domain', null),
'prefix' => config('fortify.prefix'),
], function () {
$this->loadRoutesFrom(base_path('vendor/laravel/fortify/routes/routes.php'));
});
}); |
Some third-party packages will require some additional work to support. While supporting every package is unfeasible, it's perhaps worth looking into some additional addons to at least support Laravel's first-party packages.
This is a non-exhaustive list of packages to look into supporting.
Note
Some of these packages won't require any work, or may require so much work that they cannot be supported.
Discussion: https://github.com/orgs/sprout-laravel/discussions/72
The text was updated successfully, but these errors were encountered: