���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
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
/
app
/
Exports
/
Viewing: UnitExport.php
<?php namespace App\Exports; use App\Models\FormulaUnit; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithMapping; use Maatwebsite\Excel\Events\AfterSheet; use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Concerns\ShouldAutoSize; class UnitExport implements FromCollection, WithHeadings , WithEvents ,ShouldAutoSize { /** * @return \Illuminate\Support\Collection */ protected $resultCount; public $headings_array=[ 'label'=>'نام فارسی', 'label_en'=>'نام انگلیسی', 'length'=>'طول', 'width'=>'عرض', 'var_1'=>'محاسبه یک', 'var_2'=>'محاسبه دو', 'count'=>'تعداد', 'sort'=>'اولویت نمایش', 'width_one'=>'عرض یک', 'width_two'=>'عرض دو', 'length_one'=>'طول یک', 'length_two'=>'طول دو', 'material_id'=>'متریال', 'unit_id'=>'نام یونیت', ]; public $cols=[ 'label', 'label_en', 'length', 'width', 'var_1', 'var_2', 'count', 'sort', 'width_one', 'width_two', 'length_one', 'length_two', 'material_id', 'unit_id', ]; public function headings(): array { return $this->headings_array; } public function collection() { $result=FormulaUnit:: when($this->cols,function($q){ $q->select($this->cols); } ) ->with('unit') ->orderBy('id','desc')->get(); foreach ($result as $row) { $row['unit_id']=$row->unit->title; $row['material_id']=$row->material?->title; $row['var_2']=$row->var_2 ? $row->var_2 : '---'; $row['var_1']=$row->var_1 ? $row->var_1 : '---'; $row['sort']=$row->sort ? $row->sort : '---'; $row['width_one']=($row->width_one == '1' ? 'نوار' : ($row->width_one == '2' ? 'فارسی': ( $row->width_one == '3' ? 'شیار' : '---')) ); $row['width_two']=($row->width_two == '1' ? 'نوار' : ($row->width_two == '2' ? 'فارسی': ( $row->width_two == '3' ? 'شیار' : '---')) ); $row['length_one']=($row->length_one == '1' ? 'نوار' : ($row->length_one == '2' ? 'فارسی': ( $row->length_one == '3' ? 'شیار' : '---')) ); $row['length_two']=($row->length_two == '1' ? 'نوار' : ($row->length_two == '2' ? 'فارسی': ( $row->length_two == '3' ? 'شیار' : '---')) ); } $this->resultCount=count($result)+1; return $result; } public function registerEvents(): array { $styleArray = ['font' => ['bold' => true]]; return [ AfterSheet::class => function (AfterSheet $event) use ($styleArray) { // bold heading $event->sheet->getStyle("A1:BJ{$this->resultCount}") ->applyFromArray($styleArray); // change direction to rtl $event->sheet->setRightToLeft(true); // center all text $event->sheet ->getStyle("A1:BJ{$this->resultCount}") ->getAlignment()->setHorizontal('center'); }, ]; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa