Entry module
Setup
To make use of the entry module, you'll need to activate it.
php
use QoreWorksBusiness\QoreFrontend\QoreFrontendPlugin;
class QorePanelServiceProvider extends QorePanelServiceProviderBase
{
public function panel(QorePanel|Panel $panel): QorePanel
{
return parent::panel($panel)
// ....
->plugins([
QoreFrontendPlugin::make()
->setEntryResource(true),
]);
}
}If you want to have more or other entry system labels to use for positions, you can pass that to the setEntryResource. For example:
php
QoreFrontendPlugin::make()
->setEntryResource(true, EntryLocation::class),Make sure to have the trait HasEntry included to the EntryLocation.
php
use QoreWorksBusiness\QoreAdminBase\Concerns\HasEnumHelper;
use QoreWorksBusiness\QoreFrontend\Contracts\HasEntry;
enum EntryLocation: string implements HasEntry
{
use HasEnumHelper;
case CUSTOM = 'custom';
}Frontend
To make use of the entry, you can fetch the model by location for example:
php
use QoreWorksBusiness\QoreFrontend\Enums\EntryLocation;
use QoreWorksBusiness\QoreFrontend\Models\Entry;
public function index(): View
{
$entry = Entry::findByLocation(EntryLocation::HOMEPAGE);
return view('application.portal.pages.home', compact('entry'));
}Published entries can also be viewed by slug. Add the entry routes to your application's route file:
php
use QoreWorksBusiness\QoreFrontend\QoreFrontendRouting;
QoreFrontendRouting::entryRoutes();This registers GET /entry/{entry:slug} under the name entry.index when the entry resource is active.