PHP code example of naska-it / nova-mediable-manager
1. Go to this page and download the library: Download naska-it/nova-mediable-manager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
naska-it / nova-mediable-manager example snippets
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
return [
new \NaskaIt\NovaMediableManager\NovaMediableManager
];
}
use NaskaIt\NovaMediableManager\HasMedia;
class Page extends Model
{
use HasMedia;
use NaskaIt\NovaMediableManager\Mediable;
class Page extends Resource
{
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make(__('ID'), 'id')->sortable(),
Text::make('Name'),
Trix::make('Body'),
Mediable::make('Image')
->hideFromIndex()
->isSingle(),
Mediable::make('Featured')
->isSingle(),
Mediable::make('Gallery'),
];
}
use NaskaIt\NovaMediableManager\Mediable;
public function fields()
{
return [
Text::make('Headline'),
Text::make('Slogan'),
Mediable::make('Block')
->isSingle()
->isFlexible(),
];
}
use NaskaIt\NovaMediableManager\HasFlexibleMediable;
class BlockLayout extends Layout
{
use HasFlexibleMediable;