File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/app/Komma/Kms/Dashboard/DashboardSection.php
<?php
namespace App\Komma\Kms\Dashboard;
//The new object oriented attributes
use App\Komma\Kms\Core\Sections\Section;
use App\Komma\Kms\Core\Sections\Tabs\Collections\NoLanguageTabs;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
class DashboardSection extends Section
{
protected $title = 'Importeren';
protected $subtitle = 'All pages';
protected $slug = 'dashboard';
protected $hasRoutes = true;
public $showSave = 'all';
public $showDelete = [];
public $showCreate = [];
/**
* PageSection constructor.
* @param string $slug
*/
public function __construct(string $slug)
{
$sectionTabDirector = new NoLanguageTabs();
parent::__construct($sectionTabDirector, $slug);
$this->submitButtonLabel = __('kms/dashboard.dashboard');
}
/**
* Generates the attributes for this section. They all must extend the App\Komma\Kms\Core\Attributes\Attribute class
* This is the place where you need to setup your sections appearance. Just make sure you build an array of attributes
* and put each attribute in a AbstractSectionTabItem with a SectionTabGroups constant to link them to a tab.
*
* @param Model|null $currentModel
* @return Collection A collection of SectionTabItems
* @see PageRepository::saveModel()
*/
protected function generateAttributes(Model $currentModel = null): Collection
{
// Note: The "attributes are hardcoded in dashboard.blade.php because this method isn't giving is the right amount of flexibility right now"
//
// //*****************************************************************************************\\
// //*** Define attribute validation sets ***\\
// //*****************************************************************************************\\
// //*****************************************************************************************\\
// //*** Generate the attributes ***\\
// //*****************************************************************************************\\
//
// //****************************************************************************************************************************************\\
// //*** Put the all attributes in a SectionTabItem so we can track for which tab they are. And then put SectionTabItems in a Collection ***\\
// //****************************************************************************************************************************************\\
$tabItems = new Collection();
// foreach($attributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::General));
// foreach($languageIndexedAttributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::Languages));
//
return $tabItems;
}
/**
* Makes the view and returns it
*
* @return View
*/
protected function makeView(): View
{
$successes = (\Session::has('successes')) ? \Session::get('successes') : new MessageBag();
return view('kms/dashboard.index', [
'section' => $this,
]);
}
}