2022-03-05 16:02:12 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2022-05-15 04:01:48 +02:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-03-05 16:02:12 +01:00
|
|
|
|
|
|
|
class Shared extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
public $table = 'shared_hosting';
|
|
|
|
|
|
|
|
protected $fillable = ['id', 'active', 'main_domain', 'has_dedicated_ip', 'ip', 'shared_type', 'provider_id', 'location_id', 'bandwidth', 'disk', 'disk_type', 'disk_as_gb', 'domains_limit', 'subdomains_limit', 'ftp_limit', 'email_limit', 'db_limit', 'was_promo', 'owned_since'];
|
|
|
|
|
|
|
|
public $incrementing = false;
|
2022-05-15 04:01:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
public static function sharedRelatedCacheForget(): void
|
|
|
|
{
|
|
|
|
Cache::forget('services_count');//Main page services_count cache
|
|
|
|
Cache::forget('due_soon');//Main page due_soon cache
|
|
|
|
Cache::forget('recently_added');//Main page recently_added cache
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function sharedDataIndexPage()
|
|
|
|
{
|
|
|
|
return DB::table('shared_hosting as s')
|
|
|
|
->join('providers as p', 's.provider_id', '=', 'p.id')
|
|
|
|
->join('locations as l', 's.location_id', '=', 'l.id')
|
|
|
|
->join('pricings as pr', 's.id', '=', 'pr.service_id')
|
|
|
|
->get(['s.*', 'p.name as provider_name', 'pr.*', 'l.name as location']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function sharedDataShowPage(string $shared_id)
|
|
|
|
{
|
|
|
|
return DB::table('shared_hosting as s')
|
|
|
|
->join('pricings as pr', 's.id', '=', 'pr.service_id')
|
|
|
|
->join('providers as p', 's.provider_id', '=', 'p.id')
|
|
|
|
->join('locations as l', 's.location_id', '=', 'l.id')
|
|
|
|
->where('s.id', '=', $shared_id)
|
|
|
|
->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function sharedEditDataPage(string $shared_id)
|
|
|
|
{
|
|
|
|
return DB::table('shared_hosting as s')
|
|
|
|
->join('pricings as p', 's.id', '=', 'p.service_id')
|
|
|
|
->where('s.id', '=', $shared_id)
|
|
|
|
->get(['s.*', 'p.*']);
|
|
|
|
}
|
2022-03-05 16:02:12 +01:00
|
|
|
}
|