当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::find方法代码示例

本文整理汇总了PHP中Application::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::find方法的具体用法?PHP Application::find怎么用?PHP Application::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application的用法示例。


在下文中一共展示了Application::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: applicationsAction

 public function applicationsAction()
 {
     $date = new DateTime("now");
     if ($this->request->isPost() and $this->request->isAjax()) {
         $start_from = $this->request->getPost('start_from', 'int');
         $type = $this->request->getPost('type', 'int');
         if ($type == 1) {
             $apps = Application::find(array('conditions' => 'confirmed = 0 and term >= ?1', 'order' => 'term DESC', 'limit' => '5', 'offset' => $start_from, 'bind' => array(1 => $date->format('Y.m.d'))));
         } else {
             if ($type == 2) {
                 $apps = Application::find(array('conditions' => 'confirmed = 1 and term >= ?1', 'order' => 'term DESC', 'limit' => '5', 'offset' => $start_from, 'bind' => array(1 => $date->format('Y.m.d'))));
             } else {
                 if ($type == 3) {
                     $apps = Application::find(array('conditions' => 'confirmed = 1 and term < ?1', 'order' => 'term DESC', 'limit' => '5', 'offset' => $start_from, 'bind' => array(1 => $date->format('Y.m.d'))));
                 } else {
                     $apps = array();
                 }
             }
         }
         $services = array();
         $users = array();
         foreach ($apps as $key => $app) {
             $str = "";
             $a_ss = ApplicationService::find(array('conditions' => 'application_id = ?1', 'bind' => array(1 => $app->id)));
             foreach ($a_ss as $a_s) {
                 $service = Service::findFirst(array('conditions' => 'id = ?1', 'bind' => array(1 => $a_s->service_id)));
                 $str .= $service->name . ', ';
             }
             $services[$key] = substr($str, 0, -2) . '.';
             $car = Car::findFirst(array('conditions' => 'number = ?1', 'bind' => array(1 => $app->car)));
             $users[$key] = User::findFirst(array('conditions' => 'id = ?1', 'bind' => array(1 => $car->owner)));
         }
         if (count($apps) > 0) {
             $view = clone $this->view;
             $view->start();
             $view->setRenderLevel(View::LEVEL_ACTION_VIEW);
             $view->setParamToView('apps', $apps);
             $view->setParamToView('type', $type);
             $view->setParamToView('services', $services);
             $view->setParamToView('users', $users);
             $view->render('admin', 'applications');
             $view->finish();
             $content = $view->getContent();
             $this->view->disable();
             $status = 200;
             $description = 'OK';
             $headers = array();
             $contentType = 'application/json';
             $content = json_encode($content);
             $response = new \Phalcon\Http\Response();
             $response->setStatusCode($status, $description);
             $response->setContentType($contentType, 'UTF-8');
             $response->setContent($content);
             foreach ($headers as $key => $value) {
                 $response->setHeader($key, $value);
             }
             return $response;
         } else {
             return 0;
         }
     }
 }
开发者ID:Flerki,项目名称:CarRepairTotal,代码行数:62,代码来源:AdminController.php

示例2: css

 /**
  * Show the form for creating a new resource.
  * GET /api/create
  *
  * @return Response
  */
 public function css($id)
 {
     $css = "";
     foreach (Application::find($id)->versions()->get() as $version) {
         $css = $css . $version->css;
     }
     return Response::make($css, '200')->header('Content-Type', 'text/css');
 }
开发者ID:Devided,项目名称:Versions,代码行数:14,代码来源:APIController.php

示例3: deleteScore

 public function deleteScore()
 {
     $application_id = Input::get('application_id');
     $application = Application::find($application_id);
     if (!$application->delete()) {
         return Response::json(array('errCode' => 1, 'message' => '删除失败!'));
     }
     return Response::json(array('errCode' => 0, 'message' => '删除成功!'));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:9,代码来源:AdminScoreController.php

示例4: postStore

 public function postStore()
 {
     $input = \Input::all();
     if ($input['parent_id']) {
         $parentApplication = \Application::find($input['parent_id']);
     } else {
         $parentApplication = $this->application;
     }
     $validation = \Validator::make($input, \Application::$rules);
     // dd($input);
     if ($validation->passes()) {
         $newApp = new \Application();
         $newApp->name = $input['name'];
         $newApp->user_id = \Auth::user()->id;
         //$newApp->parent_id = $parentApplication->id;
         $newApp->cms_package = $parentApplication->cms_package;
         $parentApplication->children()->save($newApp);
         //TODO: Fix baum here - not saving correctly
         \Application::rebuild();
         //we need to do the urls..
         $domains = explode(',', $input['domain']);
         $appUrls = [];
         foreach ($domains as $domain) {
             $appUrl = new \ApplicationUrl();
             $appUrl->domain = $domain;
             $appUrl->folder = '/';
             //TODO: folders - is this ever going to work?
             $appUrls[] = $appUrl;
         }
         $newApp->url()->saveMany($appUrls);
         //and the plugins
         $parentPlugins = $parentApplication->plugins()->get();
         foreach ($parentPlugins as $parentPlugin) {
             $newApp->plugins()->attach($parentPlugin->id);
             //associate($parentPlugin)
         }
         return redirect()->action('\\Bootleg\\Cms\\ApplicationController@anyIndex')->with(['success' => 'Application Succesfully Created']);
     }
     \Request::flash();
     return redirect()->back()->withErrors($validation->errors());
 }
开发者ID:niallkatana,项目名称:bootlegcms,代码行数:41,代码来源:ApplicationController.php

示例5: applyAction

 public function applyAction()
 {
     if ($this->request->isPost()) {
         $user = $this->getAuth();
         $new_car = $this->request->getPost('new_car');
         if ($new_car == 0) {
             $car = Car::findFirst(array('conditions' => 'number = ?1', 'bind' => array(1 => $this->request->getPost('choose-car'))));
         } else {
             $car = new Car();
             $car->number = $this->request->getPost('number');
             $car->brand = $this->request->getPost('brand');
             $car->model = $this->request->getPost('model');
             $car->owner = $user['user_id'];
             if (!$car->save()) {
                 message($this, "d", "Данные об автомобиле указаны неверно");
                 return $this->response->redirect("applyForService");
             }
         }
         if ($car) {
             $date = $this->request->getPost('date');
             $time = $this->request->getPost('time');
             $apps = Application::find(array('conditions' => 'term = ?1', 'bind' => array(1 => $date)));
             if ($date) {
                 if ($time) {
                     if (count($apps) < 4 * 20) {
                         $services = $this->request->getPost('services');
                         if (count($services) > 0) {
                             $app = new Application();
                             $app->car = $car->number;
                             $app->term = $date . ' ' . $time;
                             $app->confirmed = 0;
                             $app->manager = NULL;
                             if ($app->save()) {
                                 foreach ($services as $service) {
                                     $as = new ApplicationService();
                                     $as->application_id = $app->id;
                                     $as->service_id = $service;
                                     if (!$as->save()) {
                                         message($this, "d", "Ошибка при сохранении выбранной услуги");
                                         return $this->response->redirect("applyForService");
                                     }
                                 }
                                 //todo! Обработка поля с доп. информацией
                                 message($this, "s", "Заявка отправлена. В ближайшее время наш менеджер свяжется с Вами для ее подтверждения");
                                 return $this->response->redirect("cabinet");
                             } else {
                                 message($this, "d", "Ошибка при сохранении заявки");
                                 foreach ($app->getMessages() as $message) {
                                     message($this, "d", "Ошибка: " . $message->getMessage() . " в поле " . $message->getField() . ". Тип: " . $message->getType());
                                 }
                                 return $this->response->redirect("applyForService");
                             }
                         } else {
                             message($this, "d", "Минимум одна услуга должна быть выбрана");
                             return $this->response->redirect("applyForService");
                         }
                     } else {
                         message($this, "d", "Выбранная дата занята. Пожалуйста, выберите другой день");
                         return $this->response->redirect("applyForService");
                     }
                 } else {
                     message($this, "d", "Время не выбрано!");
                     return $this->response->redirect("applyForService");
                 }
             } else {
                 message($this, "d", "Дата не выбрана!");
                 return $this->response->redirect("applyForService");
             }
         } else {
             message($this, "d", "Автомобиль не найден");
             return $this->response->redirect("applyForService");
         }
     }
 }
开发者ID:Flerki,项目名称:CarRepairTotal,代码行数:74,代码来源:UserController.php

示例6: getSwitch

 public function getSwitch($id)
 {
     $application = \Application::find($id);
     if ($application) {
         \Session::put('cms_app', $id);
         return redirect()->back()->with('message', 'Application switched');
     } else {
         return redirect()->back()->with('message', 'An error occured when switching app');
     }
 }
开发者ID:ryzr,项目名称:bootlegcms,代码行数:10,代码来源:ApplicationController.php

示例7: deleteLink

 /**
  * Remove the specified resource from storage.
  * DELETE /application/{appid}/{versionid}
  *
  * @param  int  $appid
  * @param  int  $versionid
  * @return Response
  */
 public function deleteLink($appid, $versionid)
 {
     Application::find($appid)->versions()->detach($versionid);
     return Redirect::action('ApplicationController@show', [$appid])->withSuccess('Plugin removed.');
 }
开发者ID:Devided,项目名称:Versions,代码行数:13,代码来源:ApplicationController.php


注:本文中的Application::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。