pavloniym/nova-iframe-page is a Laravel package for a laravel nova tool..
It currently has 3 GitHub stars and 1.284 downloads on Packagist (latest version v1.0.0).
Install it with composer require pavloniym/nova-iframe-page.
Discover more Laravel packages by pavloniym
or browse all Laravel packages to compare alternatives.
Last updated
This Laravel Nova package allows you to create pages with iframe content, making it easy to embed external websites or internal application pages within your Nova admin panel. The package is fully customizable, enabling you to adjust the iframe's appearance and behavior to suit your needs.
You can install the package via Composer:
composer require pavloniym/nova-iframe-page
To register the routes for the iframe page, you need to modify your NovaServiceProvider. Add the following code to the routes method:
use Pavloniym\NovaIframePage\NovaIframePage;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
// ...
/**
* Register the Nova routes.
*
* @return void
*/
protected function routes()
{
// ...
// default nova routes
NovaIframePage::make()
->setSrc('https://mycoolsite.com')
->setPath('custom-iframe-path')
->register();
}
// ...
}
To add the iframe page tool to the Nova sidebar menu, modify the tools method in your NovaServiceProvider as follows:
use Pavloniym\NovaIframePage\NovaIframePage;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
// ...
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
return [
NovaIframePage::make()
->setIcon('server')
->setName('My Cool Site')
->setPath('custom-iframe-path'),
];
}
// ...
}
The package provides several methods to customize the iframe page:
Set the URL of the page you want to display in the iframe.
NovaIframePage::make()->setSrc('https://mycoolsite.com');
You can adjust the height of the iframe using the setHeight method. The height can be any valid CSS height value.
NovaIframePage::make()->setHeight('600px');
If you want to disable scrolling within the iframe, use the setNoScroll method.
NovaIframePage::make()->setNoScroll(true);
To remove the default top padding of the iframe content, use the setNoTopPadding method.
NovaIframePage::make()->setNoTopPadding(true);
To remove the iframe's border, use the setNoFrameBorder method.
NovaIframePage::make()->setNoFrameBorder(true);
You can enable or disable the border radius around the iframe using the setWithBorderRadius method.
NovaIframePage::make()->setWithBorderRadius(true);
You can pass an array of styles to the iframe using the setIframeStyles method.
NovaIframePage::make()->setIframeStyles([
'border' => '1px solid #ddd',
'margin-top' => '20px',
]);
Additional iframe options can be passed using the setIframeOptions method.
NovaIframePage::make()->setIframeOptions([
'sandbox' => 'allow-scripts allow-same-origin',
]);
Here's a complete example of how to configure and use the NovaIframePage tool in your Nova admin panel:
use Pavloniym\NovaIframePage\NovaIframePage;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
protected function routes()
{
Nova::routes()
->withAuthenticationRoutes()
->register();
NovaIframePage::make()
->setPath('/custom-page')
->setSrc('https://example.com')
->setHeight('700px')
->setNoScroll(true)
->setNoTopPadding(true)
->setNoFrameBorder(true)
->setWithBorderRadius(false)
->setIframeStyles([
'border' => '2px solid #333',
'box-shadow' => '0 0 10px rgba(0, 0, 0, 0.5)',
])
->setIframeOptions([
'sandbox' => 'allow-forms allow-popups',
])
->register();
}
public function tools()
{
return [
NovaIframePage::make()
->setName('Custom Page')
->setPath('/custom-page'),
];
}
}
In this example, the iframe page is configured to display a custom page from https://example.com with specific styles, options, and settings.
The Nova Iframe Page Tool for Laravel Nova provides a flexible way to embed external content directly within your Nova admin panel. With customizable settings and easy integration, you can enhance your admin interface by adding iframe pages tailored to your needs.
This package is open-source software licensed under the MIT license. Feel free to contribute, report issues, or suggest improvements!