Updated to use Eloquent rather than DB::table()
This commit is contained in:
parent
ae9b23cba7
commit
b512caecc7
|
@ -21,12 +21,12 @@ class Labels extends Model
|
||||||
|
|
||||||
public static function deleteLabelsAssignedTo($service_id): void
|
public static function deleteLabelsAssignedTo($service_id): void
|
||||||
{
|
{
|
||||||
DB::table('labels_assigned')->where('service_id', $service_id)->delete();
|
LabelsAssigned::where('service_id', $service_id)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteLabelAssignedAs($label_id): void
|
public static function deleteLabelAssignedAs($label_id): void
|
||||||
{
|
{
|
||||||
DB::table('labels_assigned')->where('label_id', $label_id)->delete();
|
LabelsAssigned::where('label_id', $label_id)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function insertLabelsAssigned(array $labels_array, string $service_id): void
|
public static function insertLabelsAssigned(array $labels_array, string $service_id): void
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Models;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class Locations extends Model
|
class Locations extends Model
|
||||||
{
|
{
|
||||||
|
@ -20,7 +19,7 @@ class Locations extends Model
|
||||||
public static function allLocations(): array
|
public static function allLocations(): array
|
||||||
{
|
{
|
||||||
return Cache::remember("locations", now()->addMonth(1), function () {
|
return Cache::remember("locations", now()->addMonth(1), function () {
|
||||||
return DB::table('locations')->orderBy('name')->get()->toArray();
|
return self::orderBy('name')->get()->toArray();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Models;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class OS extends Model
|
class OS extends Model
|
||||||
{
|
{
|
||||||
|
@ -20,7 +19,7 @@ class OS extends Model
|
||||||
public static function allOS(): array
|
public static function allOS(): array
|
||||||
{
|
{
|
||||||
return Cache::remember("operating_systems", now()->addMonth(1), function () {
|
return Cache::remember("operating_systems", now()->addMonth(1), function () {
|
||||||
return DB::table('os')->orderBy('name')->get()->toArray();
|
return self::orderBy('name')->get()->toArray();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Providers extends Model
|
||||||
public static function allProviders(): array
|
public static function allProviders(): array
|
||||||
{
|
{
|
||||||
return Cache::remember("providers", now()->addMonth(1), function () {
|
return Cache::remember("providers", now()->addMonth(1), function () {
|
||||||
return DB::table('providers')->orderBy('name')->get()->toArray();
|
return self::orderBy('name')->get()->toArray();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user