Added return types

This commit is contained in:
cp6 2023-08-19 23:46:18 +10:00
parent 455cf45c29
commit 507f128bf6
12 changed files with 31 additions and 31 deletions

View File

@ -17,7 +17,7 @@ class DiskSpeed extends Model
protected $fillable = ['id', 'server_id', 'd_4k', 'd_4k_type', 'd_4k_as_mbps', 'd_64k', 'd_64k_type', 'd_64k_as_mbps', 'd_512k', 'd_512k_type', 'd_512k_as_mbps', 'd_1m', 'd_1m_type', 'd_1m_as_mbps'];
public function yabs()
public function yabs(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Yabs::class, 'id', 'id');
}

View File

@ -41,17 +41,17 @@ class Domains extends Model
});
}
public function provider()
public function provider(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function price()
public function price(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
public function labels(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}

View File

@ -13,7 +13,7 @@ class Home extends Model
{
use HasFactory;
public static function homePageCacheForget()
public static function homePageCacheForget(): void
{
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache

View File

@ -20,7 +20,7 @@ class IPs extends Model
public $incrementing = false;
public static function deleteIPsAssignedTo($service_id)
public static function deleteIPsAssignedTo($service_id): void
{
DB::table('ips')->where('service_id', $service_id)->delete();
}

View File

@ -19,17 +19,17 @@ class Labels extends Model
protected $fillable = ['id', 'label', 'server_id', 'server_id_2', 'domain_id', 'domain_id_2', 'shared_id', 'shared_id_2'];
public static function deleteLabelsAssignedTo($service_id)
public static function deleteLabelsAssignedTo($service_id): void
{
DB::table('labels_assigned')->where('service_id', $service_id)->delete();
}
public static function deleteLabelAssignedAs($label_id)
public static function deleteLabelAssignedAs($label_id): void
{
DB::table('labels_assigned')->where('label_id', $label_id)->delete();
}
public static function insertLabelsAssigned(array $labels_array, string $service_id)
public static function insertLabelsAssigned(array $labels_array, string $service_id): void
{
for ($i = 1; $i <= 4; $i++) {
if (!is_null($labels_array[($i - 1)])) {
@ -38,14 +38,14 @@ class Labels extends Model
}
}
public static function labelsCount()
public static function labelsCount(): int
{
return Cache::remember('labels_count', now()->addMonth(1), function () {
return Labels::count();
});
}
public function assigned()
public function assigned(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(LabelsAssigned::class, 'label_id', 'id');
}

View File

@ -17,7 +17,7 @@ class LabelsAssigned extends Model
protected $keyType = 'string';
public function label()
public function label(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Labels::class, 'id', 'label_id');
}

View File

@ -52,7 +52,7 @@ class Misc extends Model
});
}
public function price()
public function price(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}

View File

@ -17,7 +17,7 @@ class NetworkSpeed extends Model
protected $fillable = ['id', 'server_id', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps', 'created_at', 'updated_at'];
public function yabs()
public function yabs(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Yabs::class, 'id', 'id');
}

View File

@ -53,27 +53,27 @@ class Reseller extends Model
});
}
public function ips()
public function ips(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(IPs::class, 'service_id', 'id');
}
public function location()
public function location(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public function provider()
public function provider(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function price()
public function price(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
public function labels(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}

View File

@ -53,22 +53,22 @@ class SeedBoxes extends Model
});
}
public function location()
public function location(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public function provider()
public function provider(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function price()
public function price(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
public function labels(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}

View File

@ -53,27 +53,27 @@ class Shared extends Model
});
}
public function ips()
public function ips(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(IPs::class, 'service_id', 'id');
}
public function location()
public function location(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public function provider()
public function provider(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function price()
public function price(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
public function labels(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}

View File

@ -39,17 +39,17 @@ class Yabs extends Model
});
}
public function server()
public function server(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Server::class, 'id', 'server_id');
}
public function disk_speed()
public function disk_speed(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(DiskSpeed::class, 'id', 'id');
}
public function network_speed()
public function network_speed(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(NetworkSpeed::class, 'id', 'id');
}