当前位置: 首页>>代码示例>>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;未经允许,请勿转载。