File: D:/HostingSpaces/blijegasten/blijegasten.be/app/Komma/Shop/Properties/Kms/PropertyController.php
<?php
namespace App\Komma\Shop\Properties\Kms;
use App\Komma\Kms\Core\SectionController;
use App\Komma\Shop\Properties\Models\Api\PropertyResource;
use App\Komma\Shop\Properties\Models\Property;
use App\Komma\Shop\Properties\Models\PropertyKeyTranslation;
use Illuminate\Http\Request;
class PropertyController extends SectionController
{
protected $slug = "properties";
protected $classModelName = Property::class;
public function __construct()
{
$section = new PropertySection($this->slug);
parent::__construct($section);
$this->modelService = new PropertyService();
}
/**
* For ajax requests
*
* @param Request $request
* @param string $keyTranslationValue
*
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
* @see PropertyService::getPropertiesForPropertyKeyValue()
*/
public function getPropertiesForPropertyKeyValue(Request $request, string $keyTranslationValue)
{
if(!$request->ajax()) abort(403);
$propertiesCollection = $this->modelService->getPropertiesForPropertyKeyValue($keyTranslationValue)->get();
return PropertyResource::collection($propertiesCollection);
}
}