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


PHP Board::select方法代码示例

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


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

示例1: getIndex

 public function getIndex()
 {
     if (!$this->option('adventureEnabled')) {
         return abort(404);
     }
     $adventures = BoardAdventure::select('board_uri')->where('adventurer_ip', inet_pton(Request::ip()))->get();
     $board_uris = [];
     foreach ($adventures as $adventure) {
         $board_uris[] = $adventure->board_uri;
     }
     $board = Board::select('board_uri')->whereNotIn('board_uri', $adventures)->wherePublic()->whereIndexed()->whereLastPost(48)->get();
     if (count($board)) {
         $board = $board->random(1);
         $newAdventure = new BoardAdventure(['board_uri' => $board->board_uri, 'adventurer_ip' => inet_pton(Request::ip())]);
         $newAdventure->expires_at = $newAdventure->freshTimestamp()->addHours(1);
         $newAdventure->save();
     } else {
         $board = false;
     }
     return $this->view(static::VIEW_ADVENTURE, ['board' => $board]);
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:21,代码来源:AdventureController.php

示例2: importInfinityRolesAndBoards

 /**
  * Imports users and creates roles based on addition data in that row.
  *
  * @return void
  */
 public function importInfinityRolesAndBoards()
 {
     # BORROW SEEDERS
     require base_path() . "/database/seeds/OptionSeeder.php";
     require base_path() . "/database/seeds/PermissionSeeder.php";
     require base_path() . "/database/seeds/RoleSeeder.php";
     # DESTROY SEQUENCE
     if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
         $this->comment("\tDropping role sequence.");
         DB::statement("DROP SEQUENCE IF EXISTS roles_role_id_seq CASCADE;");
     }
     $PermissionSeeder = new \PermissionSeeder();
     $PermissionSeeder->setCommand($this);
     $PermissionSeeder->run();
     $PermissionGroupSeeder = new \PermissionGroupSeeder();
     $PermissionGroupSeeder->setCommand($this);
     $PermissionGroupSeeder->run();
     $OptionSeeder = new \OptionSeeder();
     $OptionSeeder->setCommand($this);
     $OptionSeeder->run();
     $OptionGroupSeeder = new \OptionGroupSeeder();
     $OptionGroupSeeder->setCommand($this);
     $OptionGroupSeeder->run();
     $RoleSeeder = new \RoleSeeder();
     $RoleSeeder->setCommand($this);
     $RoleSeeder->runMaster();
     $RolePermissionSeeder = new \RolePermissionSeeder();
     $RolePermissionSeeder->setCommand($this);
     $RolePermissionSeeder->run();
     \Artisan::call('cache:clear');
     # REPAIR SEQUENCE
     if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
         $this->comment("\tCreating role_id sequence again.");
         DB::statement("CREATE SEQUENCE roles_role_id_seq;");
         $pgSeqNext = DB::table('roles')->select(DB::raw("(MAX(\"role_id\") + 1) AS next"))->pluck("next");
         DB::statement("ALTER SEQUENCE roles_role_id_seq OWNED BY \"roles\".\"role_id\" RESTART WITH {$pgSeqNext};");
         DB::statement("ALTER TABLE roles ALTER COLUMN role_id SET DEFAULT nextval('roles_role_id_seq');");
     }
     # THEIR TABLES
     $tBoardsTable = $this->tcon->table("boards")->join('board_create', 'boards.uri', '=', 'board_create.uri')->select('boards.*', 'board_create.time');
     $tModsTable = $this->tcon->table("mods");
     # BEGIN USER IMPORT
     $this->info("\tImporting Users ...");
     $userAdmin = null;
     $userBoardRelationships = [];
     $usersImported = 0;
     $tModsTable->chunk(100, function ($mods) use(&$userAdmin, &$userBoardRelationships, &$usersImported) {
         $this->line("\t\tHandling 100 users ...");
         foreach ($mods as $mod) {
             # CREATE USER
             $user = new User(['username' => $mod->username, 'email' => property_exists($mod, "email") ? $mod->email ?: null : null, 'password' => null, 'password_legacy' => json_encode(['hasher' => "Vichan", 'hash' => $mod->password, 'salt' => $mod->salt])]);
             // 8chan has an issue with duplicates.
             try {
                 $saved = $user->save();
             } catch (\Exception $e) {
                 $saved = false;
             }
             if ($saved) {
                 ++$usersImported;
                 # REMEMBER ROLES
                 if ($mod->boards) {
                     // TODO
                     // Pull these values from config when formal importer created.
                     switch ($mod->type) {
                         // Janitor (Disabled)
                         case 10:
                             // Disabled
                         // Disabled
                         case 99:
                             $this->comment("\t\tMod {$user->username} is disabled.");
                             break;
                             // Board volunteer
                         // Board volunteer
                         case 19:
                             // Board owner
                         // Board owner
                         case 20:
                             if (!isset($userBoardRelationships[$mod->boards])) {
                                 $userBoardRelationships[$mod->boards] = [];
                             }
                             $userBoardRelationships[$mod->boards][$user->user_id] = $mod->type;
                             break;
                             // Global volunteer
                         // Global volunteer
                         case 25:
                             $this->comment("\t\tSetting {$user->username} to Global Mod.");
                             $user->roles()->attach(Role::ID_MODERATOR);
                             break;
                             // Admin
                         // Admin
                         case 30:
                             $this->comment("\t\tSetting {$user->username} to Global Admin.");
                             $user->roles()->attach(Role::ID_ADMIN);
                             $userAdmin = $userAdmin ?: $user;
                             break;
//.........这里部分代码省略.........
开发者ID:LulzNews,项目名称:infinity-next,代码行数:101,代码来源:Import.php

示例3: getDetails

 /**
  * Returns basic board details. 
  *
  * @return Response
  */
 public function getDetails(Request $request)
 {
     $boardUris = Input::get('boards', []);
     $boards = Board::select('board_uri', 'title')->whereIn('board_uri', $boardUris)->orderBy('board_uri', 'desc')->take(20)->get();
     return $boards;
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:11,代码来源:BoardlistController.php


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