���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
/
cutunix-shot
/
app
/
Livewire
/
Admin
/
Pages
/
Message
/
Viewing: Order.php
<?php namespace App\Livewire\Admin\Pages\Message; use Livewire\Component; use Livewire\WithPagination; use App\Models\Message; use App\Models\Order as orderModel; use function App\Helpers\DateNow; use function App\Helpers\sendSms; use Livewire\WithFileUploads; use Illuminate\Filesystem\Filesystem; use App\Helpers\HelperClass\GeneralUse; use Masmerise\Toaster\Toastable; use function App\Helpers\uploadFile; use Illuminate\Support\Facades\Auth; class Order extends Component { use Toastable; use WithFileUploads; use WithPagination; public $file; public $search = ''; public $msg; public $user; public $ticket_id; public $title; public $perPage = 15; public $message_id; public $order_id; public $order; public $customer; public function loadMore() { $this->perPage += 10; } public function mount( ) { $this->authorize('messages.chat'); $this->order=orderModel::where('id',$this->order_id)->with('customer','user')->first(); if($this->order){ $this->user=$this->order->user; $this->customer=$this->order->customer; $this->perPage = 15; $this->dispatch('scrollDown'); } $this->msg=''; $this->message_id=''; } public function edit_message($item,$type='edit') { if($type == 'edit'){ $this->msg=$item['msg']; $this->message_id=$item['id']; }else{ $this->msg=''; $this->message_id=''; } } public function delete_message($id) { Message::where('id',$id)->delete(); $this->success( 'پیام با موفقیت حذف گردید '); return $this->dispatch('refreshMulti'); } public function updatedfile( ) { $this->validate([ 'file.*' => 'mimes:heic,jpeg,jpg,png,pdf,xlsx,xls,txt,docx,mp4,mp3,ogg,dwg,dxf,zip|max:30720', ]); $this->dispatch('startLoading'); foreach ($this->file as $value) { $msg=uploadFile($value); $this->sendMessage('file',$msg); } } public function sendMessage($type=null,$value=null) { $msg=$this->msg; $mims='text'; if($value){ $msg=$value; } if($type != 'text'){ $explode=explode('.',env('FILE_URL').$msg); if(count($explode) > 0){ $mims=$explode[count($explode)-1]; } } if($msg){ if($this->message_id){ Message::where('id',$this->message_id)->update([ 'msg'=>$msg, 'date_show'=>DateNow('add_day_s',0), ]); $this->message_id=''; }else{ $message=Message::create([ 'msg'=>$msg, 'type'=>$type, 'mims'=>$mims, 'date_show'=>DateNow('add_day_s',0), 'status'=>'admin', 'class'=>'order', 'seen'=>'no', 'sender_id'=>auth()->user()->id, 'receptor_id'=>$this->user->id, 'order_id'=>$this->order->id ]); } $this->msg=''; if($this->user && $this->user->device_token){ $title='پیام جدید'; $body='شما یک پیام جدید در سفارش شماره '.$this->order->number.' دارید '; GeneralUse::send_push_massage([$this->user->device_token],$title,$body); } $this->dispatch('endLoading'); } } public function render() { $messages=[]; if($this->order){ Message::where('class','order')->where('status','user')->where('order_id',$this->order->id)->where(function($q) { $q->where(function($a) { $a->where('sender_id',$this->user->id); })->orWhere(function($b) { $b->Where('receptor_id',$this->user->id); }); })->update([ 'seen'=>'yes' ]); $messages=Message::where('class','order')->where('order_id',$this->order->id)->latest()->paginate($this->perPage); $messages=$messages->setCollection($messages->getCollection()->reverse()); } $data=['messages'=> $messages]; return view('livewire.admin.pages.message.order',$data); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa