예제 #1
0
 public function action_pkpass($id)
 {
     if ($pass = Model_Pass::find($id)) {
         $manager = new Pass_File_Manager($pass);
         if (file_exists($manager->pkpass_path())) {
             $pkpass = file_get_contents($manager->pkpass_path());
             return Response::forge($pkpass, 200, array('Content-Type' => 'application/vnd.apple.pkpass'));
         } else {
             throw new \Fuel\Core\HttpNotFoundException();
         }
     } else {
         throw new \Fuel\Core\HttpNotFoundException();
     }
 }
예제 #2
0
 public function get_pkpass_name()
 {
     if (!empty($this->pkpass_name)) {
         return $this->pkpass_name;
     }
     $pkpass_name = \Fuel\Core\Str::random('alpha', 8) . '.pkpass';
     while (Model_Pass::find()->where(array('pkpass_name' => $pkpass_name))->get_one()) {
         $pkpass_name = \Fuel\Core\Str::random('alpha', 8) . '.pkpass';
     }
     $this->pkpass_name = $pkpass_name;
     $this->save();
     return $this->pkpass_name;
 }