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


PHP Tag::create方法代码示例

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


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

示例1: test_should_bind_sql_bind_in_using_active_records

 public function test_should_bind_sql_bind_in_using_active_records()
 {
     $Tag = new Tag();
     $Tag->create(array('name' => 'Tag 1'));
     $Tag->create(array('name' => 'Tag 2'));
     $this->assertTrue($Tags = $Tag->find(array('conditions' => array('name IN (?)', $Tag->find()))));
     $this->assertEqual($Tags[0]->name, 'Tag 1');
     $this->assertEqual($Tags[1]->name, 'Tag 2');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:_AkActiveRecord_finders.php

示例2: run

 public function run()
 {
     DB::table('tags')->delete();
     Tag::create(array('name' => 'spring'));
     Tag::create(array('name' => 'summer'));
     Tag::create(array('name' => 'apple'));
 }
开发者ID:ahumellihuk,项目名称:blogging-platform,代码行数:7,代码来源:TagTableSeeder.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Tag::create(['name' => $faker->word]);
     }
 }
开发者ID:rudihartomo,项目名称:Laravel-RestAPI,代码行数:7,代码来源:TagsTableSeeder.php

示例4: generate

 private function generate()
 {
     $tags = array('auth' => 'auth', 'eloquent' => 'eloquent');
     foreach ($tags as $name => $slug) {
         Tag::create(array('name' => $name, 'slug' => $slug));
     }
 }
开发者ID:kcsamita,项目名称:laravelsnippets,代码行数:7,代码来源:TagSeeder.php

示例5: run

 public function run()
 {
     $tags = array_values(Lang::get('tags'));
     foreach ($tags as $tag) {
         Tag::create(array('name' => $tag));
     }
 }
开发者ID:wcoder,项目名称:basont,代码行数:7,代码来源:TagsSeeder.php

示例6: run

 public function run()
 {
     DB::table('tags')->delete();
     Tag::create(['name' => 'Announcements']);
     Tag::create(['name' => 'Engineering']);
     Tag::create(['name' => 'Features']);
 }
开发者ID:pogliozzy,项目名称:larabase,代码行数:7,代码来源:TagsTableSeeder.php

示例7: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Tag::create(['title' => $faker->firstname()]);
     }
 }
开发者ID:ayooby,项目名称:whatisit,代码行数:7,代码来源:TagsTableSeeder.php

示例8: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Tag::create([]);
     }
 }
开发者ID:SunRey,项目名称:blog.dev,代码行数:7,代码来源:TagsTableSeeder.php

示例9: createComponentPageEditForm

 protected function createComponentPageEditForm($name)
 {
     $form = $this->createPageFormBase($name, false);
     if (!$form->isSubmitted()) {
         $id = $this->getParam("id");
         $page = Page::find($id);
         $values = $page->getValues();
         $values["tags"] = $page->Tags->fetchColumn("id");
         $form->setDefaults($values);
     }
     $presenter = $this;
     $form->onSubmit[] = function ($form) use($presenter) {
         $values = $form->values;
         try {
             $page = Page::create($values);
             $page->Tags = array_map(function ($id) {
                 return Tag::create($id);
             }, $values["tags"]);
             $page->save();
             $presenter->flashMessage("Page '{$page->name}' was changed!");
             $presenter->redirect("default", array("id" => $page->id));
         } catch (ModelException $e) {
             $page->addErrorsToForm($form);
         }
     };
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:26,代码来源:PagePresenter.php

示例10: testNewRecordWithNewReferenced

 public function testNewRecordWithNewReferenced()
 {
     $page = Page::create(array("name" => "English article", "description" => "Description", "text" => "Text in english.", "allowed" => true));
     $page->Tags[] = Tag::create(array("name" => "Society", "url" => "society"));
     $page->Tags[] = Tag::create(array("name" => "Previte", "url" => "previte"));
     $page->save();
     $this->assertEquals(2, count(Page::findByName("English article")->Tags));
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:8,代码来源:ManyToManyTest.php

示例11: test_create_tag

 public function test_create_tag()
 {
     $t = Tag::create(array('tag_text' => $this->text, 'tag_slug' => $this->slug));
     $this->assertType('Tag', $t);
     $this->assertEquals($t->tag_slug, $this->slug);
     $this->assertEquals($t->tag_text, $this->text);
     $t->delete();
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:8,代码来源:tagTest.php

示例12: run

 public function run()
 {
     $tags = array('Winning', 'Bi-Winning', 'Win Here', 'Win There', 'Win Win Everywhere', 'Can\'t Stop', 'Won\'t Stop', 'Feel Like Losing', 'Party Hard', 'Relationships', 'Travel', 'Charlie Sheen');
     foreach ($tags as $tag) {
         $name = array('name' => $tag);
         Tag::create($name);
     }
 }
开发者ID:j-beere,项目名称:laravel-blog,代码行数:8,代码来源:TagTableSeeder.php

示例13: store

 /**
  * Store a newly created tag in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Tag::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Tag::create($data);
 }
开发者ID:mkwarren21,项目名称:blog.dev,代码行数:13,代码来源:TagsController.php

示例14: store

 /**
  * Store a newly created tag in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Tag::validate($data = Input::all());
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Tag::create($data);
     return Redirect::route('admin.tags.index');
 }
开发者ID:pogliozzy,项目名称:larabase,代码行数:14,代码来源:TagsController.php

示例15: run

 public function run()
 {
     Tag::truncate();
     $template = 'app/views/admin/template.blade.php';
     $info = file_get_contents($template);
     $values = array('Phone', 'Tablet', 'Laptop', 'Accessories');
     foreach ($values as $value) {
         Tag::create(array('name' => $value, 'slug' => Str::slug($value), 'template' => $info, 'block' => 0));
     }
 }
开发者ID:VoDongMy,项目名称:VoDongMy,代码行数:10,代码来源:TagSeeder.php


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