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