���Root Mod By V1rus_Alfa
User / IP
:
216.73.216.158
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
portal-cutunix
/
app
/
Livewire
/
Site
/
Pages
/
Analyze
/
Unit
/
Viewing: Add.php
<?php namespace App\Livewire\Site\Pages\Analyze\Unit; use Modules\Central\Models\Unit; use Modules\Central\Models\AnalyzeDimension; use Modules\Central\Models\UnitList; use Illuminate\Support\Facades\Auth; use Livewire\Attributes\Url; use Livewire\Component; use Masmerise\Toaster\Toastable; use function App\Helpers\toEnDigit; use App\Helpers\HelperClass\GeneralUseV2; class Add extends Component { use Toastable; public $unit; public $project_id; public $dimension = []; public $computing = []; public $selectedMaterial; #[Url(history: true, keep: true)] public $form = [ 'count' => 1, ]; protected $listeners = [ 'SetRow' => 'handelSetRow', 'refreshPage' => 'handelComputing' ]; public function mount($id, $project_id = null) { $this->project_id = $project_id; $this->unit = Unit::where('id', $id)->where('status', 'true')->first(); $this->dimension = AnalyzeDimension::where('user_id', auth()->user()->id)->get(); if (!$this->unit) { abort(404); } $arrayItemsAreExists = true; if (0 < count($this->unit->variables)) { foreach ($this->unit->variables as $variable) { $this->form[$variable->key] = $variable->default ?? 0; } foreach ($this->unit->variables as $var) { $arrayItemsAreExists = isset($this->form[$var->key]); } if (request('form') !== null) $this->form = request('form'); } if ($arrayItemsAreExists && isset($this->form['type'])) { $this->handelComputing($this->form['type']); } } public function handelComputing($type = 'computing') { $this->form['count'] = intval(\App\Helpers\toEnDigit($this->form['count'])); $this->form['type'] = $type; $this->form['unit_title'] = $this->unit->title; $this->form['unit_id'] = $this->unit->id; $this->form['project_id'] = $this->project_id; //VALIDATION $validateUnit = validateUnitData($this->form, $this->unit, $this->computing); if ($validateUnit) { $this->error($validateUnit); return; } $property = []; foreach ($this->unit->variables as $value) { $property[] = ['key' => $value->key, 'value' => toEnDigit($this->form[$value->key])]; } $hasError = false; // check any dimension of slices shouldn't lte zero foreach ($this->computing as $key => $item) { $title = "تکه ی " . $key + 1; if ($item['width'] <= 5) { $error = "مقدار عرض غیر قابل پردازش دارد؛ ابعاد را اصلاح کنید"; $hasError = true; $this->error($title . $error); } if ($item['length'] <= 5) { $error = "مقدار طول غیر قابل پردازش دارد؛ ابعاد را اصلاح کنید"; $hasError = true; $this->error($title . $error); } if ($item['count'] <= 0) { $error = "مقدار تعداد غیر قابل پردازش دارد؛ ابعاد را اصلاح کنید"; $hasError = true; $this->error($title . $error); } } if ($hasError) return redirect()->back(); if ($this->form['type'] === 'set') { GeneralUseV2::computing_unit((object)$this->form, $property); } else { $this->computing = GeneralUseV2::computing_unit((object)$this->form, $property); } if ($this->form['type'] == 'set' && !$hasError) { // $this->dispatch('success', trans('container.operation successful')); session()->flash('success', trans('container.operation successful')); if ($this->project_id) { return redirect()->to('/' . app()->getLocale() . '/analyze/projects/units/' . $this->project_id); } else { return redirect()->to('/' . app()->getLocale() . '/analyze/list'); } } } public function handelDelete($i) { array_splice($this->computing, $i - 1, 1); } public function handelSetRow($data) { $this->computing[$data['key'] - 1] = $data['row']; $this->dispatch('success', trans('container.operation successful')); } public function render() { return view('livewire.site.pages.analyze.unit.add') ->layout('components.layouts.site.app', ['page_name' => 'analyze', 'previousRoute' => route('analyze.units', ['locale' => 'fa', 'category' => $this->unit->category])]); } public function handleSelectedMaterial($variable) { $this->selectedMaterial = $variable; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa