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


PHP Manager::table方法代码示例

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


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

示例1: test_sessions_sweep_when_hits_lottery

 public function test_sessions_sweep_when_hits_lottery()
 {
     $config = ['sessions.driver' => 'database'];
     $this->dispatch($config);
     $rec = $this->capsule->getConnection()->table('sessions')->get();
     $this->assertSame(1, count($rec));
     $config['sessions.lifetime'] = 0;
     $config['sessions.lottery'] = [1, 1];
     // 100% hits
     $this->dispatch($config);
     $rec = $this->capsule->table('sessions')->get();
     $this->assertEmpty($rec);
 }
开发者ID:yusukezzz,项目名称:slim-session-manager,代码行数:13,代码来源:SessionTest.php

示例2: validateUnique

 private function validateUnique($item, $value, $parameter)
 {
     $results = DB::table($parameter)->where($item, '=', $value)->get();
     if (sizeof($results) > 0) {
         $this->errors[] = $item . ' already exists on this system.';
     }
 }
开发者ID:marious,项目名称:talkingspace_forum,代码行数:7,代码来源:Validator.php

示例3: seedData

 protected function seedData()
 {
     $faker = $this->getFaker();
     for ($i = 0; $i < $this->count; $i++) {
         DB::table('tests')->insert(['title' => $faker->title, 'seq' => $i + 1, 'created_at' => $faker->dateTime(), 'updated_at' => $faker->dateTime()]);
     }
 }
开发者ID:janez89,项目名称:repository,代码行数:7,代码来源:InterceptorTest.php

示例4: acceptFriendRequest

 public function acceptFriendRequest($token, $requestId)
 {
     $user = new User();
     $meId = $user->getMeId($token);
     try {
         $requestData = Capsule::table('friendrequests')->select('userFrom', 'userTo')->where('id', $requestId)->first();
         if ($requestData->userFrom == $meId) {
             $newFriendId = $requestData->userTo;
         } else {
             $newFriendId = $requestData->userFrom;
         }
     } catch (\Exception $e) {
         throw new \Exception('Wystąpił błąd przy pobieraniu przyjaciół');
     }
     if ($user->isUserMyFriend($newFriendId, $token)) {
         throw new \Exception('Ten użytkownik jest już Twoim znajomym');
     }
     try {
         Capsule::table('friendrequests')->where('id', $requestId)->where('userFrom', $meId)->orWhere('userTo', $meId)->where('accepted', 0)->update(array('accepted' => 1));
         Capsule::table('friends')->insert(array('userA' => $meId, 'userB' => $newFriendId));
     } catch (\Exception $e) {
         throw new \Exception('Wystąpił błąd przy pobieraniu przyjaciół');
     }
     $newFriendData = $user->getUser($newFriendId, $token);
     return $newFriendData;
 }
开发者ID:jar5551,项目名称:matchApp,代码行数:26,代码来源:Friend.php

示例5: queryBuilder

 /**
  * For raw array fetching.  Must be static, otherwise PHP gets confused about where to find the table_id.
  */
 public static function queryBuilder()
 {
     // Set query builder to fetch result sets as associative arrays (instead of creating stdClass objects)
     Capsule::connection()->setFetchMode(\PDO::FETCH_ASSOC);
     $table = Database::getSchemaTable(static::$_table_id)->name;
     return Capsule::table($table);
 }
开发者ID:andriyrusyn,项目名称:tracker,代码行数:10,代码来源:UFModel.php

示例6: storeFull

 protected function storeFull($json)
 {
     $categories = json_decode($json, true);
     // grab categories from the database
     $dbCategories = collect(DB::table('categories')->get(['cSlug']))->keyBy('cSlug')->toArray();
     // grab an array of columns in the categories table
     $columns = DB::select('select COLUMN_NAME as `column` from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = \'fmtc_categories\'');
     // set the counters for reporting
     $insertCount = 0;
     $removeCount = 0;
     // walk through the categories from a merchant feed
     $jsonCategoryIds = [];
     foreach ($categories as $category) {
         // is the category missing from the database?
         if (!isset($dbCategories[$category['cSlug']])) {
             // insert it (this is faster than building an insert queue and bulk inserting)
             DB::table('categories')->insert($this->formatForInsertion($category, $columns));
             $insertCount++;
         }
         // collect an array of ids to aid in the remove	queue
         $jsonCategoryIds[] = $category['cSlug'];
     }
     // remove old categories showing up in the database but not in the new merchant feed.
     $removeQueue = array_diff(array_keys($dbCategories), $jsonCategoryIds);
     $removeCount = count($removeQueue);
     foreach ($removeQueue as $categoryId) {
         DB::table('categories')->where('cSlug', $categoryId)->delete();
     }
     //---- debugging
     // debug($removeCount . ' removed');
     // debug($insertCount . ' inserted');
     //-----
     return true;
 }
开发者ID:calebporzio,项目名称:fmtc-php,代码行数:34,代码来源:CategoryFeed.php

示例7: testSerialize

 public function testSerialize()
 {
     $eloquentDriver = new EloquentDriver();
     $output = $eloquentDriver->serialize(Capsule::table('users')->find(1));
     $expected = array('@type' => 'stdClass', 'id' => array('@scalar' => 'string', '@value' => '1'), 'account_manager_id' => array('@scalar' => 'string', '@value' => '1'), 'username' => array('@scalar' => 'string', '@value' => 'Nil'), 'password' => array('@scalar' => 'string', '@value' => 'password'), 'email' => array('@scalar' => 'string', '@value' => 'test@example.com'), 'created_at' => array('@scalar' => 'string', '@value' => '2016-01-13 00:06:16'), 'updated_at' => array('@scalar' => 'string', '@value' => '2016-01-13 00:06:16'), 'deleted_at' => array('@scalar' => 'NULL', '@value' => null));
     $this->assertEquals($expected, $output);
 }
开发者ID:nilportugues,项目名称:serializer-eloquent-driver,代码行数:7,代码来源:EloquentDriverTest.php

示例8: seedData

 protected function seedData()
 {
     $faker = $this->getFaker();
     for ($i = 1; $i <= $this->count; $i++) {
         DB::table('tests')->insert(['title' => $faker->title, 'seq' => $i, 'created_at' => $i > 5 ? (new DateTime('2005-01-01'))->format('Y-m-d H:i:s') : (new DateTime('1998-01-01'))->format('Y-m-d H:i:s'), 'updated_at' => $faker->dateTime()]);
     }
 }
开发者ID:janez89,项目名称:repository,代码行数:7,代码来源:DataTableTest.php

示例9: seeInDatabase

 /**
  * Check to see some data in the database
  */
 protected function seeInDatabase($table, $data)
 {
     $conditions = [];
     foreach ($data as $key => $value) {
         $conditions[] = [$key, $value];
     }
     $this->assertTrue(DB::table($table)->where($conditions)->count() > 0);
 }
开发者ID:Jirka-Mayer,项目名称:Mycelium,代码行数:11,代码来源:TestCase.php

示例10: getBySearch

 public function getBySearch($search)
 {
     $networks = DB::table('networks')->where(function ($query) use($search) {
         $search = '%' . $search . '%';
         $query->where('cSlug', 'like', $search)->orWhere('aCountries', 'like', $search)->orWhere('cName', 'like', $search);
     })->get();
     return $networks;
 }
开发者ID:FMTCco,项目名称:fmtc-php,代码行数:8,代码来源:Networks.php

示例11: formatDealForReturn

 protected function formatDealForReturn($deal)
 {
     // attach it's categories
     $deal->aCategories = DB::table('deals_categories')->where('deals_categories.nCouponID', $id)->join('categories', 'categories.cSlug', '=', 'deals_categories.cCategorySlug')->get();
     // attach it's types
     $deal->aTypes = DB::table('deals_types')->where('deals_types.nCouponID', $id)->join('types', 'types.cSlug', '=', 'deals_types.cTypeSlug')->get();
     return $deal;
 }
开发者ID:calebporzio,项目名称:fmtc-php,代码行数:8,代码来源:Deals.php

示例12: run

 public function run()
 {
     DB::table('posts')->delete();
     Post::unguard();
     Post::create(['id' => 1, 'title' => 'First post', 'body' => 'This is the first post!']);
     Post::create(['id' => 2, 'title' => 'Second post', 'body' => 'This is the second post!']);
     Post::reguard();
 }
开发者ID:jackw899,项目名称:laravel-commentable,代码行数:8,代码来源:PostSeeder.php

示例13: getBySearch

 public function getBySearch($search)
 {
     $merchants = DB::table('merchants')->where(function ($query) use($search) {
         $search = '%' . $search . '%';
         $query->where('nMerchantID', 'like', $search)->orWhere('nMasterMerchantID', 'like', $search)->orWhere('cName', 'like', $search);
     })->get();
     return $merchants;
 }
开发者ID:calebporzio,项目名称:fmtc-php,代码行数:8,代码来源:Merchants.php

示例14: getBySearch

 public function getBySearch($search)
 {
     $types = DB::table('types')->where(function ($query) use($search) {
         $search = '%' . $search . '%';
         $query->where('cSlug', 'like', $search)->orWhere('cName', 'like', $search);
     })->get();
     return $types;
 }
开发者ID:FMTCco,项目名称:fmtc-php,代码行数:8,代码来源:Types.php

示例15: gen

 public static function gen()
 {
     $id = Capsule::table('uid')->insertGetId(array());
     if (!$id) {
         throw new Exception("Could not generate UID!");
     }
     return $id;
 }
开发者ID:huglester,项目名称:pyrocms-helpers,代码行数:8,代码来源:uid.php


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