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. This can be done by having the following route:
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Http\Controllers\EntryController;
use QoreWorksBusiness\QoreFrontend\QoreFrontendPlugin;
if (QoreFrontendPlugin::get()->entryResourceIsActive()) {
Route::get('/entry/{entry:slug}', [EntryController::class, 'index'])
->name('entry.index');
}