1. Go to this page and download the library: Download dewsign/nova-spaces 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/ */
dewsign / nova-spaces example snippets
// app/Nova/SidebarSpace.php
namespace App\Nova;
use Dewsign\NovaSpaces\Nova\Space;
class SidebarSpace extends Space
{
public static $zone = 'sidebar';
public static function label()
{
return __('Sidebar Items');
}
}
@foreach(Space::active()->whereZone('sidebar')->get() as $spaceItem)
{!! $spaceItem->view !!}
{!! or !!}
<a href="{{ $spaceItem->action }}">{{ $spaceItem->label }}</a>
@endforeach
@foreach($spaceItem->spaces as $item)
{!! $item->view !!}
@endforeach
// app/Space/Models/Section.php
use Dewsign\NovaSpaces\Models\SpaceItem;
class Section extends SpaceItem
{
public static $repeaterBlockViewTemplate = 'space.section';
public function resolveAction()
{
return $this->link_url;
}
public function resolveLabel($model = null)
{
return $model->title ?? $this->heading;
}
}