當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Repository::set方法代碼示例

本文整理匯總了PHP中Repository::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Repository::set方法的具體用法?PHP Repository::set怎麽用?PHP Repository::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Repository的用法示例。


在下文中一共展示了Repository::set方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: edit

 function edit($id = null)
 {
     if (empty($this->data)) {
         if (is_null($id)) {
             $this->redirect('index');
         }
         $repo = $this->Repository->read(null, $id);
         if (empty($repo)) {
             $this->e404();
         }
         $this->data = $repo;
         $current = 'repositories';
         $menu = 'menu_admin';
         $this->set(compact('current', 'menu'));
     } else {
         $this->Repository->set($this->data);
         if (!$this->Repository->validates()) {
             $this->Session->setFlash($this->Repository->validationErrors, 'flash_errors');
         } elseif (!$this->Repository->save()) {
             $this->Session->setFlash('An error ocurred saving the repository. Please, blame the developer', 'flash_errors');
         } else {
             $this->Session->setFlash('Repository saved');
             CakeLog::write('activity', 'Repository [id=' . $id . '] edited');
             $this->redirect('index');
         }
     }
 }
開發者ID:rmeruane,項目名稱:repositorium,代碼行數:27,代碼來源:admin_repositories_controller.php

示例2: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->config = $this->app->make('Illuminate\\Config\\Repository');
     $this->event = $this->app->make('Illuminate\\Events\\Dispatcher');
     $this->view = $this->app->make('Illuminate\\View\\Factory');
     $this->package('ipunkt/auth');
     if ($this->config->get('auth::set_usermodel', false) == true) {
         $this->config->set('auth.model', 'Ipunkt\\Auth\\models\\EloquentUser');
     }
     if ($this->config->get('auth::set_repository', false) == true) {
         $this->app->bind('Ipunkt\\Auth\\Repositories\\RepositoryInterface', 'Ipunkt\\Auth\\Repositories\\EloquentRepository');
     }
     $this->registerEventListeners();
     $this->registerViewComposers();
     require_once __DIR__ . "/../../routes.php";
 }
開發者ID:ipunkt,項目名稱:auth,代碼行數:21,代碼來源:AuthServiceProvider.php

示例3: create

 function create()
 {
     if ($this->getConnectedUser() == $this->anonymous) {
         $this->redirect(array('controller' => 'login'));
     }
     if (!empty($this->data)) {
         $user = $this->getConnectedUser();
         $this->data['Repository']['user_id'] = $user['User']['id'];
         // adding Constituents to a new Kit
         $selectConstituents = $this->data['Repository']['Constituents'];
         $this->Kit->save();
         foreach ($selectConstituents as $constituent) {
             $this->ConstituentsKit->create();
             $this->ConstituentsKit->set('kit_id', $this->Kit->id);
             $this->ConstituentsKit->set('constituent_id', $constituent);
             $this->ConstituentsKit->save();
         }
         // update Repository kit_id
         $this->data['Repository']['kit_id'] = $this->Kit->id;
         $this->Repository->set($this->data);
         if ($this->Repository->validates()) {
             $repository = $this->Repository->createNewRepository($this->data, $user);
             CakeLog::write('activity', "Repository [name=\"{$repository['Repository']['name']}\"] created");
             if (is_null($repository)) {
                 $this->Session->setFlash('An error occurred creating the repository. Please, blame the developer');
                 $this->redirect('/');
             }
             $this->_make_user_expert();
             if (Configure::read('App.subdomains')) {
                 $dom = Configure::read('App.domain');
                 $this->redirect("http://{$repository['Repository']['url']}.{$dom}");
             } else {
                 $this->redirect(array('action' => 'index', $repository['Repository']['url']));
             }
         } else {
             $this->Session->setFlash($this->Repository->invalidFields(), 'flash_errors');
         }
     }
     $constituents = $this->Constituent->find('superlist', array('fields' => array('id', 'name', 'description'), 'separator' => ': '));
     $this->set(compact('constituents'));
 }
開發者ID:rmeruane,項目名稱:repositorium,代碼行數:41,代碼來源:repositories_controller.php


注:本文中的Repository::set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。