feat: add webservices extension class
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
* @license GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Moko\Plugin\WebServices\MokoSuiteBooking\Extension;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Router\ApiRouter;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
final class MokoSuiteBooking extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onBeforeApiRoute' => 'onBeforeApiRoute',
|
||||
];
|
||||
}
|
||||
|
||||
public function onBeforeApiRoute(&$router): void
|
||||
{
|
||||
$routes = [
|
||||
'bookings' => 'bookingbookings',
|
||||
'services' => 'bookingservices',
|
||||
'staff' => 'bookingstaff',
|
||||
'schedules' => 'bookingschedules',
|
||||
'locations' => 'bookinglocations',
|
||||
'waitlist' => 'bookingwaitlist',
|
||||
];
|
||||
|
||||
$defaults = ['component' => 'com_mokosuitebooking', 'public' => false];
|
||||
|
||||
foreach ($routes as $pattern => $controller) {
|
||||
$router->createCRUDRoutes(
|
||||
'v1/mokosuitebooking/' . $pattern,
|
||||
$controller,
|
||||
$defaults
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user