| 
									
										
										
										
											2022-03-06 02:02:12 +11:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace App\Models; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Factories\HasFactory; | 
					
						
							|  |  |  | use Illuminate\Database\Eloquent\Model; | 
					
						
							| 
									
										
										
										
											2022-05-09 14:57:38 +10:00
										 |  |  | use Illuminate\Support\Facades\Cache; | 
					
						
							| 
									
										
										
										
											2022-03-06 02:02:12 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | class OS extends Model | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     use HasFactory; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-06 02:58:25 +11:00
										 |  |  |     protected $fillable = ['name']; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-22 23:49:18 +10:00
										 |  |  |     protected $keyType = 'string'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-06 02:02:12 +11:00
										 |  |  |     protected $table = 'os'; | 
					
						
							| 
									
										
										
										
											2022-05-09 14:57:38 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public static function allOS(): array | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return Cache::remember("operating_systems", now()->addMonth(1), function () { | 
					
						
							| 
									
										
										
										
											2023-08-19 23:52:59 +10:00
										 |  |  |             return self::orderBy('name')->get()->toArray(); | 
					
						
							| 
									
										
										
										
											2022-05-09 14:57:38 +10:00
										 |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-03-06 02:02:12 +11:00
										 |  |  | } |