Server IP : 66.29.132.124 / Your IP : 18.218.250.241 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/modules/Car/Blocks/ |
Upload File : |
<?php namespace Modules\Car\Blocks; use Modules\Template\Blocks\BaseBlock; use Modules\Core\Models\Terms; class CarTermFeaturedBox extends BaseBlock { function __construct() { $this->setOptions([ 'settings' => [ [ 'id' => 'title', 'type' => 'input', 'inputType' => 'text', 'label' => __('Title') ], [ 'id' => 'desc', 'type' => 'input', 'inputType' => 'text', 'label' => __('Desc') ], [ 'id' => 'term_car', 'type' => 'select2', 'label' => __('Select term car'), 'select2' => [ 'ajax' => [ 'url' => route('car.admin.attribute.term.getForSelect2', ['type' => 'car']), 'dataType' => 'json' ], 'width' => '100%', 'multiple' => "true", ], 'pre_selected' => route('car.admin.attribute.term.getForSelect2', [ 'type' => 'car', 'pre_selected' => 1 ]) ], ], 'category'=>__("Service Car") ]); } public function getName() { return __('Car: Term Featured Box'); } public function content($model = []) { if (empty($term_car = $model['term_car'])) { return ""; } $list_term = Terms::whereIn('id',$term_car)->with('translations')->get(); $model['list_term'] = $list_term; return view('Car::frontend.blocks.term-featured-box.index', $model); } public function contentAPI($model = []){ $model['list_term'] = null; if (!empty($term_car = $model['term_car'])) { $list_term = Terms::whereIn('id',$term_car)->get(); if(!empty($list_term)){ foreach ( $list_term as $item){ $model['list_term'][] = [ "id"=>$item->id, "attr_id"=>$item->attr_id, "name"=>$item->name, "image_id"=>$item->image_id, "image_url"=>get_file_url($item->image_id,"full"), "icon"=>$item->icon, ]; } } } return $model; } }