Server IP : 66.29.132.124 / Your IP : 3.139.235.100 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/Space/Blocks/ |
Upload File : |
<?php namespace Modules\Space\Blocks; use Modules\Template\Blocks\BaseBlock; use Modules\Core\Models\Terms; class SpaceTermFeaturedBox 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_space', 'type' => 'select2', 'label' => __('Select term space'), 'select2' => [ 'ajax' => [ 'url' => route('space.admin.attribute.term.getForSelect2', ['type' => 'space']), 'dataType' => 'json' ], 'width' => '100%', 'multiple' => "true", ], 'pre_selected' => route('space.admin.attribute.term.getForSelect2', [ 'type' => 'space', 'pre_selected' => 1 ]) ], ], 'category'=>__("Service Space") ]); } public function getName() { return __('Space: Term Featured Box'); } public function content($model = []) { if (empty($term_space = $model['term_space'])) { return ""; } $list_term = Terms::whereIn('id',$term_space)->with('translations')->get(); $model['list_term'] = $list_term; return view('Space::frontend.blocks.term-featured-box.index', $model); } public function contentAPI($model = []){ $model['list_term'] = null; if (!empty($term_space = $model['term_space'])) { $list_term = Terms::whereIn('id',$term_space)->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; } }