KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/account.appointkrypt.com/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/account.appointkrypt.com/app/Models/Plan.php
<?php

namespace App\Models;

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

class Plan extends Model
{
    use HasFactory;
    protected $fillable = [
        'modules',
        'name',
        'trial',
        'trial_days',
        'number_of_business',
        'number_of_user',
        'custom_plan',
        'active',
        'is_free_plan',
        'package_price_monthly',
        'package_price_yearly',
        'price_per_user_monthly',
        'price_per_user_yearly',
        'price_per_business_monthly',
        'price_per_business_yearly',

    ];

    public static $arrDuration = [
        'Unlimited' => 'Unlimited',
        'month' => 'Per Month',
        'Year' => 'Per Year',
    ];
    public static $plan_type = [
        0 => 'Paid',
        1 => 'Free',
    ];
    public function fields()
    {
        return $this->hasOne('App\Models\PlanField', 'plan_id','id');
    }
    public static function total_plan()
    {
        return Plan::count();
    }
    public static function most_purchese_plan()
    {
        $free_plan = Plan::select('id')->where('price', '<=', 0)->get()->toArray();

        return User:: select(DB::raw('count(*) as total'))->where('type', '=', 'company')->whereNotIn('active_plan',$free_plan)->groupBy('active_plan')->first();
    }
}

Anon7 - 2021