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


PHP Site::create方法代码示例

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


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

示例1: run

 public function run()
 {
     DB::table('sites')->delete();
     for ($i = 0; $i < 5; $i++) {
         for ($j = 0; $j < 5; $j++) {
             Site::create(array('name' => 'BTS_' . $i . $j));
         }
     }
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:9,代码来源:SiteSeeder.php

示例2: testHABTMKeepExisting

 /**
  * test HABM operations without clobbering existing records #275
  *
  * @return void
  */
 public function testHABTMKeepExisting()
 {
     $this->loadFixtures('Site', 'Domain', 'DomainsSite');
     $Site = new Site();
     $results = $Site->find('count');
     $expected = 3;
     $this->assertEquals($expected, $results);
     $data = $Site->findById(1);
     // include api.cakephp.org
     $data['Domain'] = array('Domain' => array(1, 2, 3));
     $Site->save($data);
     $Site->id = 1;
     $results = $Site->read();
     $expected = 3;
     // 3 domains belonging to cakephp
     $this->assertEquals($expected, count($results['Domain']));
     $Site->id = 2;
     $results = $Site->read();
     $expected = 2;
     // 2 domains belonging to markstory
     $this->assertEquals($expected, count($results['Domain']));
     $Site->id = 3;
     $results = $Site->read();
     $expected = 2;
     $this->assertEquals($expected, count($results['Domain']));
     $results['Domain'] = array('Domain' => array(7));
     $Site->save($results);
     // remove association from domain 6
     $results = $Site->read();
     $expected = 1;
     // only 1 domain left belonging to rchavik
     $this->assertEquals($expected, count($results['Domain']));
     // add deleted domain back
     $results['Domain'] = array('Domain' => array(6, 7));
     $Site->save($results);
     $results = $Site->read();
     $expected = 2;
     // 2 domains belonging to rchavik
     $this->assertEquals($expected, count($results['Domain']));
     $Site->DomainsSite->id = $results['Domain'][0]['DomainsSite']['id'];
     $Site->DomainsSite->saveField('active', true);
     $results = $Site->Domain->DomainsSite->find('count', array('conditions' => array('DomainsSite.active' => true)));
     $expected = 5;
     $this->assertEquals($expected, $results);
     // activate api.cakephp.org
     $activated = $Site->DomainsSite->findByDomainId(3);
     $activated['DomainsSite']['active'] = true;
     $Site->DomainsSite->save($activated);
     $results = $Site->DomainsSite->find('count', array('conditions' => array('DomainsSite.active' => true)));
     $expected = 6;
     $this->assertEquals($expected, $results);
     // remove 2 previously active domains, and leave $activated alone
     $data = array('Site' => array('id' => 1, 'name' => 'cakephp (modified)'), 'Domain' => array('Domain' => array(3)));
     $Site->create($data);
     $Site->save($data);
     // tests that record is still identical prior to removal
     $Site->id = 1;
     $results = $Site->read();
     unset($results['Domain'][0]['DomainsSite']['updated']);
     unset($activated['DomainsSite']['updated']);
     $this->assertEquals($activated['DomainsSite'], $results['Domain'][0]['DomainsSite']);
 }
开发者ID:agashish,项目名称:test_new,代码行数:67,代码来源:ModelIntegrationTest.php

示例3: createSiteAction

 public function createSiteAction()
 {
     $domains = $this->_getParam("domains");
     $domains = str_replace(" ", "", $domains);
     $domains = explode(",", $domains);
     $site = Site::create(array("rootId" => intval($this->_getParam("id")), "domains" => $domains));
     $site->save();
     $this->_helper->json($site);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:9,代码来源:DocumentController.php

示例4: site_create

 private function site_create()
 {
     if (!isset($_POST['url']) || empty($_POST['url'])) {
         // @todo redirect to site create page
         trigger_error('Please enter a URL.', E_USER_ERROR);
         exit;
     }
     $site = Site::create(array('url' => $_POST['url']));
     // redirect to site display page
     header("HTTP/1.1 301 Moved Permanently");
     header("Location: " . Options::get('base_url') . "site/?id=" . $site->id);
     exit;
 }
开发者ID:ahutchings,项目名称:seokit,代码行数:13,代码来源:SiteHandler.php

示例5: store

 public function store()
 {
     $site = Site::create(Input::all());
     Session::put('siteId', $site->id);
     return $site;
 }
开发者ID:clay-spfmlp,项目名称:claymalven,代码行数:6,代码来源:SiteController.php


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