Exemplo n.º 1
0
 public static function all_and_check($table, $id)
 {
     if (Amenity::sanitized($table)) {
         $amenities = Amenity::all();
         $amenities_of_model = Amenity::find_amenities_of($table, $id);
         foreach ($amenities as $amenity) {
             if (in_array($amenity->id, $amenities_of_model)) {
                 $amenity->checked = 'checked';
             }
         }
         return $amenities;
     }
     return null;
 }