當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。