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 /
Helpers /
[ HOME SHELL ]
Name
Size
Permission
Action
Calendar.php
12.12
KB
-rw-rw-r--
ConfigHelper.php
617
B
-rw-rw-r--
Constant.php
446
B
-rw-rw-r--
DateHelper.php
15.22
KB
-rw-rw-r--
Helper.php
4.03
KB
-rw-rw-r--
NepaliDateHelper.php
19.86
KB
-rw-rw-r--
NepaliNumberHelper.php
5.15
KB
-rw-rw-r--
OTPHelper.php
2.34
KB
-rw-rw-r--
ProjectHelper.php
17.94
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ProjectHelper.php
<?php use App\Models\Category; use App\Models\FiscalYear; use App\Models\Language; use App\Models\MasterType; use App\Models\Office; use App\Models\UserAccessControlModel; use Carbon\Carbon; use Illuminate\Database\Eloquent\Collection; use Illuminate\Mail\Markdown; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Session; use Illuminate\Support\Str; use Spatie\Permission\Models\Role; use function PHPUnit\Framework\isNull; if (!function_exists('dateCarbon')) { function dateCarbon($date, $timezone = null) { return Carbon::parse($date)->timezone($timezone); } } if (!function_exists('dateFormat')) { function dateFormat($date, $format = 'Y-m-d h:i:s A', $timezone = null) { return Carbon::parse($date)->timezone($timezone)->format($format); } } if (!function_exists('devanagari')) { function devanagari($num) { $num_nepali = array('०', '१', '२', '३', '४', '५', '६', '७', '८', '९'); $num_eng = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); $nums = str_replace($num_eng, $num_nepali, $num); return $nums; } } if (!function_exists('languageId')) { function languageId() { return Session::get('language_id'); } } if (!function_exists('user')) { function user() { return Auth::guard('web')->user(); } } if (!function_exists('userId')) { function userId() { return user()->id; } } if (!function_exists('isAuth')) { function isAuth() { if (!user()) return false; return true; } } if (!function_exists('admin')) { function admin() { return Auth::guard('admin')->user(); } } if (!function_exists('officeId')) { function officeId() { // dd(office()); return office()->id; } } if (!function_exists('office')) { function office() { return admin()->office; } } if (!function_exists('ward_no')) { function ward_no() { return office()->name; } } if (!function_exists('isHeadOffice')) { function isHeadOffice() { $office = office(); if (!$office) return false; return $office->is_head_office; } } // if (!function_exists('statusId')) { // function statusId($code) // { // $categories = categories(['sifaris_form_status']); // dd($categories); // $cat = $categories['sifaris_form_status'][$code] ? $categories['sifaris_form_status'][$code] : null; // return $cat ? $cat->id : null; // } // } if (!function_exists('adminUserId')) { function adminUserId() { return admin()->id; } } if (!function_exists('isAuthAdmin')) { function isAuthAdmin() { if (!admin()) return false; return true; } } if (!function_exists('isSuperAdmin')) { function isSuperAdmin() { if (!admin()) return false; return admin()->hasRole('Super Admin'); } } if (!function_exists('checkSuperAdmin')) { function checkSuperAdmin($role_id) { $role = Role::find($role_id); if (!$role) return false; return $role->name == 'Super Admin'; } } if (!function_exists('uuid')) { function uuid() { return Str::uuid(); } } if (!function_exists('writeModel')) { function writeModel($model, $property, $is_model_collection = false, $default = null, $canBeZero = false) { // dd($model->first()); if (!$model) return $default; if ($is_model_collection) { $model = $model->first(); if (!$model) return $default; } if ($canBeZero) { if (old($property)) { return old($property); } if (!$model) return $default ? $default : ''; if ($model->$property == 0 || !empty($model->$property)) return $model->$property; return $default ? $default : ''; } if (old($property)) return old($property); if (!$model) return $default ? $default : ''; return $model->$property ? $model->$property : ($default ? $default : ''); } } if (!function_exists('writeModelArray')) { function writeModelArray($value, $current_array, $old_array) { if ($old_array) { return in_array($value, $old_array); } if ($current_array) { return in_array($value, $current_array); } return false; } } if (!function_exists('writeCollectionFirst')) { function writeCollectionFirst($collection, $property, $is_prop_collection = false, $property_next = null, $default = null) { // return null; if (!$collection) return $default; if (!count($collection)) return $default; if (!$property) return $default; $item = $collection->first(); if (!$item) return $default; // dd($item); $item_props = $item->$property; // dd($item_props); if (!$item_props) return $default; if (!$is_prop_collection) return $item_props ? $item_props : $default; $first = $item_props->first(); // dd($first); if (!$first) return $default; // dd($first); if (!$property_next) return $first ? $first : $default; $new_item = $first->$property_next; return $new_item ? $new_item : $default; } } if (!function_exists('selectModel')) { function selectModel($model, $property, $compareValue) { // dd(old($property)); if ($model->$property == old($property)) return true; if ($model->$property == $compareValue) return true; return false; } } if (!function_exists('jsonMsg')) { function jsonMsg($type, $msg, $icon = null) { return json_encode(['type' => $type, 'message' => $msg, 'icon' => $icon]); } } if (!function_exists('changeStatus')) { function changeStatus($model_name, $model_id, $msg_name = 'Record', $col = 'is_active') { $model = app($model_name)::where(['id' => $model_id])->first(); if (!$model) { return jsonMsg('error', 'Access denied.'); } $model->$col = $model->$col == '1' ? '0' : '1'; $model->save(); $msg = $msg_name . ' updated successfully.'; $icon = $model->$col == '1' ? '<i class="fas fa-check text-success"></i>' : '<i class="fas fa-times text-danger"></i>'; return jsonMsg('success', $msg, $icon); } } if (!function_exists('changeStatusNormal')) { function changeStatusNormal($model_name, $model_id, $msg_name = 'Record', $bit_col = 'is_active') { $model = app($model_name)::where(['id' => $model_id])->first(); if (!$model) { return jsonMsg('error', 'Access denied.'); } $model->$bit_col = $model->$bit_col == '1' ? '0' : '1'; $model->save(); $msg = $model->$bit_col == '1' ? $msg_name . ' activated successfully.' : $msg_name . ' deactivated successfully.'; $icon = $model->$bit_col == '1' ? '<i class="fas fa-check text-success"></i>' : '<i class="fas fa-times text-danger"></i>'; return jsonMsg('success', $msg, $icon); } } if (!function_exists('readSearch')) { function readSearch(&$sort_by, &$sort_order, &$page_size, $filter) { if (array_key_exists('sort_by', $filter)) { $sort_by = $filter['sort_by']; if (array_key_exists('sort_order', $filter)) { $sort_order = $filter['sort_order']; } } if (array_key_exists('page_size', $filter)) { $page_size = $filter['page_size']; } else { $page_size = 10; } } } if (!function_exists('time_elapsed_string')) { function time_elapsed_string($datetime, $format = "Y-m-d H:i:s", $full = false, $locale = 'en') { if (!$full) $full = false; $now = now(); // $ago = new DateTime($datetime); $ago = DateTime::createFromFormat($format, $datetime); // dd($datetime); $diff = $now->diff($ago); if ($locale === 'np') { $string = array( 'y' => 'वर्ष', 'm' => 'महिना', // 'w' => 'हप्ता', 'd' => 'दिन', 'h' => 'घण्टा', 'i' => 'मिनेट' ); } else { $string = array( 'y' => 'year', 'm' => 'month', // 'w' => 'week', 'd' => 'day', 'h' => 'hour', 'i' => 'minute' ); } foreach ($string as $k => &$v) { if ($diff->$k) { $plural = ''; if ($locale !== 'np') $plural = $diff->$k > 1 ? 's' : ''; $v = $diff->$k . ' ' . $v . $plural; } else { unset($string[$k]); } } // dd($full); // dd(implode(', ', $string)); if (!$full) $string = array_slice($string, 0, 1); //return $string ? implode(', ', $string) . ' ago' : 'just now'; $result = $string ? implode(', ', $string) : ($locale === 'np' ? 'भर्खरै' : 'few seconds'); if ($result == 'भर्खरै') return $result; return $result . ' ' . ($locale === 'np' ? 'पहिले' : 'ago'); } } if (!function_exists('flash')) { function flash(array $arr) { foreach ($arr as $key => $item) { Session::flash($key, $item); } } } if (!function_exists('starts_with')) { function starts_with($str, $search_text) { return strpos($str, $search_text) === 0; } } if (!function_exists('minutes_human_readable')) { function minutes_human_readable($minutes) { $hr = floor($minutes / 60); $min = $minutes - $hr * 60; if ($hr && !$min) return $hr . ' hr'; if ($hr) return $hr . ' hr ' . $min . ' min'; return $min . ' min'; } } if (!function_exists('assetAdmin')) { function assetAdmin($patth) { return asset('asset/admin/' . $patth); } } if (!function_exists('array_only')) { function array_only($array, $cols_array, $by_key = true) { if ($by_key) { return array_filter($array, function ($v) use ($cols_array) { return in_array($v, $cols_array); }, ARRAY_FILTER_USE_KEY); } return array_filter($array, function ($v) use ($cols_array) { return in_array($v, $cols_array); }); } } if (!function_exists('array_least_empty')) { function array_least_empty($array = []) { if (!count($array)) return false; $count = 0; foreach ($array as $key => $value) { if (!is_null($value)) ++$count; } return $count > 0; } } if (!function_exists('create_collection')) { function create_collection($arr) { $collection = new Collection(); foreach ($arr as $key => $item) { $class = new \StdClass; $class->id = $item['id']; $class->name = $item['name']; $collection->push($class); } return $collection; } } /** * Return success json response * * @param mixed $message * @param integer $statusCode * * @return mixed */ if (!function_exists('successResponse')) { function successResponse($data = [], $message = null, $statusCode = 200) { return response()->json([ 'success' => true, 'data' => $data, 'message' => $message ], $statusCode); } } /** * Return failure json response * * @param mixed $message * @param integer $statusCode * @param int $code * * @return mixed */ if (!function_exists('failureResponse')) { function failureResponse($message, $statusCode = 500, $data = []) { return response()->json([ 'success' => false, 'message' => $message, 'data' => $data ], $statusCode); } } if (!function_exists('successArray')) { function successArray($data = null, $message = null) { return ['success' => true, 'message' => $message, 'data' => $data]; } } if (!function_exists('failureArray')) { function failureArray($message = null, $data = []) { return ['success' => false, 'message' => $message, 'data' => $data]; } } if (!function_exists('exceptionArray')) { function exceptionArray(Throwable $th, $data = []) { return ['success' => false, 'message' => $th->getMessage(), 'data' => $data]; } } if (!function_exists('languages')) { function languages() { return Language::active()->orderByDesc('is_default')->get(); } } if (!function_exists('masterType')) { function masterType($code) { return MasterType::where(['code' => $code])->first(); } } if (!function_exists('maxInt')) { function maxInt() { return 9999; } } if (!function_exists('diskInfo')) { function diskInfo($full_url) { $base_url = config('app.url'); $full_path = Str::replace($base_url, '', $full_url); info($full_path); if (Str::startsWith($full_path, '/storage/')) { return [ 'disk' => 'public', 'file_path' => Str::replaceFirst('/storage/', '', $full_path) ]; } else if (Str::startsWith($full_path, '/files/uploads/')) { return [ 'disk' => 'secured', 'file_path' => Str::replaceFirst('/files/uploads/', '', $full_path) ]; } return ['disk' => null, 'file_path' => null]; } } if (!function_exists('newsMediaUrl')) { function newsMediaUrl($post) { $media = $post->firstMedia('image'); return $media ? $media->getUrl() : null; } } if (!function_exists('setAdminUserId')) { function setAdminUserId(&$data) { $admin_user_id = adminUserId(); $data['created_by'] = $admin_user_id; $data['updated_by'] = $admin_user_id; $data['deleted_by'] = $admin_user_id; } } if (!function_exists('setUserId')) { function setUserId(&$data) { $user_id = userId(); $data['created_by_user'] = $user_id; $data['updated_by_user'] = $user_id; $data['deleted_by_user'] = $user_id; } } if (!function_exists('fiscalYearByBS')) { function fiscalYearByBS($date_bs = null) { $date_ad = adDate($date_bs); $fiscal = FiscalYear::whereDate('start_date_ad', '<=', $date_ad)->whereDate('end_date_ad', '>=', $date_ad)->first(); return $fiscal; } } if (!function_exists('fiscalYear')) { function fiscalYear($id) { return FiscalYear::find($id); } } if (!function_exists('fiscalId')) { function fiscalId() { $fiscal = fiscalYearByBS(); return $fiscal ? $fiscal->id : null; } } if (!function_exists('fiscalYears')) { function fiscalYears($active = true) { if ($active) return FiscalYear::active()->get(); return FiscalYear::get(); } } if (!function_exists('sorterPager')) { function sorterPager($filter) { //sort, paginate if (array_key_exists('page_size', $filter)) { $page_size = $filter['page_size']; } else { $page_size = 10; } if (array_key_exists('current_page', $filter)) { $current_page = $filter['current_page']; } else { $current_page = 1; } $sort_by = 'created_at'; $sort_order = 'desc'; if (array_key_exists('sort_by', $filter)) { $sort_by = $filter['sort_by']; if (array_key_exists('sort_order', $filter)) { $sort_order = $filter['sort_order']; } } return [ 'page_size' => $page_size, 'current_page' => $current_page, 'sort_by' => $sort_by, 'sort_order' => $sort_order ]; } } if (!function_exists('permissions')) { function permissions() { $admin = admin(); if (!$admin) return []; $roles = $admin->roles; if (!$roles || !count($roles)) return []; $permissions = $roles->first()->permissions->pluck('name'); return $permissions; } } if (!function_exists('can')) { function can($permission) { $admin = admin(); if (!$admin) return false; return $admin->can($permission); } } if (!function_exists('routeClass')) { function routeClass(array $route_names) { $current_route = Route::current()->getName(); if (in_array($current_route, $route_names)) { return "nav-link active"; } else return 'nav-link'; } } if (!function_exists('offices')) { function offices($active = true) { $query = app(Office::class); if ($active) { $query = $query->active(); } return $query->get(); } } if (!function_exists('ward_offices')) { function ward_offices($active = true) { $query = app(Office::class); if ($active) { $query = $query->active(); } return $query->where('is_head_office', 0)->get(); } } if (!function_exists('categories')) { function categories($codes = []) { if (count($codes)) { $master_types = MasterType::active()->whereIn('code', $codes)->get(); } else { $master_types = MasterType::active()->get(); } $categories = []; foreach ($master_types as $type) { $cat = Category::with('details')->where('type_id', $type->id)->get(); $categories[$type->code] = $cat; } return $categories; } } if (!function_exists('read_category')) { function read_category($item, $relation) { try { $category = $item->$relation; if ($category) return $category->details[0]->name; } catch (\Throwable $th) { // dd($th->getMessage()); } return ''; } }
Close