A bare bones front-end for knockout designed for maximum compatibility with "obsolete" browsers
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

40 lignes
803B

  1. <?php
  2. namespace App\Knockout;
  3. use Illuminate\Support\Facades\Cache;
  4. class Subforum {
  5. private static function unwrap($subforum)
  6. {
  7. $s = new self();
  8. $s->id = $subforum->id;
  9. $s->name = $subforum->name;
  10. $s->description = $subforum->description;
  11. return $s;
  12. }
  13. public static function getAll()
  14. {
  15. $data = (new AbstractData)->httpGet('/subforum');
  16. $json = json_decode($data);
  17. return array_map(function($subforum) {
  18. return self::unwrap($subforum);
  19. }, $json->list);
  20. }
  21. public static function updateCache()
  22. {
  23. Cache::forever('subforums', self::getAll());
  24. }
  25. public static function getCache()
  26. {
  27. return Cache::get('subforums', []);
  28. }
  29. }