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


PHP app\Board类代码示例

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


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

示例1: getBoardHistory

 public function getBoardHistory(Board $board, Post $post)
 {
     $posts = $board->posts()->with('op')->withEverything()->where('author_ip', $post->author_ip)->orderBy('post_id', 'desc')->paginate(15);
     foreach ($posts as $item) {
         $item->setRelation('board', $board);
     }
     return $this->view(static::VIEW_HISTORY, ['posts' => $posts, 'multiboard' => false]);
 }
开发者ID:GodOfConquest,项目名称:infinity-next,代码行数:8,代码来源:HistoryController.php

示例2: getPost

 /**
  * Returns a post to the client. 
  *
  * @var Board $board
  * @var Post  $post
  * @return Response
  */
 public function getPost(Board $board, Post $post)
 {
     // Pull the post.
     $post = $board->posts()->where('board_id', $post)->withEverything()->firstOrFail();
     if (!$post) {
         return abort(404);
     }
     return $post;
 }
开发者ID:JEWSbreaking8chan,项目名称:infinity-next,代码行数:16,代码来源:BoardController.php

示例3: getBoardHistory

 public function getBoardHistory(Board $board, Post $post)
 {
     if (!$this->user->canViewHistory($post)) {
         return abort(403);
     }
     $posts = $board->posts()->with('op')->withEverything()->where('author_ip', $post->author_ip)->orderBy('post_id', 'desc')->paginate(15);
     foreach ($posts as $item) {
         $item->setRelation('board', $board);
     }
     return $this->view(static::VIEW_HISTORY, ['posts' => $posts, 'multiboard' => false, 'ip' => ip_less($post->author_ip->toText())]);
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:11,代码来源:HistoryController.php

示例4: addRobotBan

 /**
  * Automatically adds a R9K ban to the specified board.
  *
  * @static
  * @param  \App\Board  $board  The board the ban is to be added in.
  * @param  binary|string|null  $ip  Optional. The IP to ban. Defaults to client IP.
  * @return static
  */
 public static function addRobotBan(Board $board, $ip = null)
 {
     $ip = new IP($ip);
     // Default time is 2 seconds.
     $time = 2;
     // Pull the ban that expires the latest.
     $ban = $board->bans()->whereIpInBan($ip)->whereRobot()->orderBy('expires_at', 'desc')->first();
     if ($ban instanceof static) {
         if (!$ban->isExpired()) {
             return $ban;
         }
         $time = $ban->created_at->diffInSeconds($ban->expires_at) * 2;
     }
     return static::create(['ban_ip_start' => $ip, 'ban_ip_end' => $ip, 'expires_at' => Carbon::now()->addSeconds($time), 'board_uri' => $board->board_uri, 'is_robot' => true, 'justification' => trans('validation.custom.unoriginal_content')]);
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:23,代码来源:Ban.php

示例5: getThreads

 /**
  * Returns a thread and its replies. 
  *
  * @param  \App\Board $board
  * @return Response
  */
 public function getThreads(Board $board)
 {
     // Determine what page we are on.
     $pages = $board->getPageCount();
     $response = [];
     for ($i = 0; $i < $pages; ++$i) {
         $pageArray = ['page' => $i, 'threads' => []];
         $threads = $board->getThreadsForIndex($i);
         foreach ($threads as $thread) {
             $pageArray['threads'][] = ['no' => (int) $thread->board_id, 'last_modified' => (int) $thread->bumped_last->timestamp];
         }
         $response[] = $pageArray;
     }
     return response()->json($response);
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:21,代码来源:BoardController.php

示例6: boardStats

 /**
  * Returns the information specified by boardStats
  *
  * @return array (indexes and vales based on $boardStats)
  */
 protected function boardStats()
 {
     $controller =& $this;
     $stats = Cache::remember('index.boardstats', 60, function () use($controller) {
         $stats = [];
         foreach ($controller->boardStats as $boardStat) {
             switch ($boardStat) {
                 case "boardIndexedCount":
                     $stats[$boardStat] = Board::whereIndexed()->count();
                     break;
                 case "startDate":
                     $stats[$boardStat] = Board::orderBy('created_at', 'desc')->take(1)->pluck('created_at')->format("M jS, Y");
                     break;
                 case "boardTotalCount":
                     $stats[$boardStat] = Board::count();
                     break;
                 case "postCount":
                     $stats[$boardStat] = Board::sum('posts_total');
                     break;
                 case "postRecentCount":
                     $stats[$boardStat] = Post::recent()->count();
                     break;
             }
         }
         return $stats;
     });
     return $stats;
 }
开发者ID:tmrwbo,项目名称:infinity-next,代码行数:33,代码来源:BoardStats.php

示例7: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('board_adventures', function (Blueprint $table) {
         $table->increments('adventure_id');
         $table->binary('adventurer_ip');
         $table->string('board_uri', 32);
         $table->integer('post_id')->unsigned()->nullable()->default(NULL);
         $table->timestamps();
         $table->timestamp('expires_at');
         $table->timestamp('expended_at')->nullable()->default(NULL);
         $table->foreign('board_uri')->references('board_uri')->on('boards')->onDelete('cascade')->onUpdate('cascade');
     });
     Schema::table('posts', function (Blueprint $table) {
         $table->integer('adventure_id')->unsigned()->nullable()->default(NULL)->after('locked_at');
         $table->foreign('adventure_id')->references('adventure_id')->on('board_adventures')->onDelete('set null')->onUpdate('cascade');
     });
     Schema::table('boards', function (Blueprint $table) {
         $table->timestamp('last_post_at')->nullable()->default(NULL)->after('updated_at');
     });
     Board::chunk(100, function ($boards) {
         foreach ($boards as $board) {
             $lastPost = $board->posts()->orderBy('created_at', 'desc')->limit(1)->get()->last();
             if ($lastPost) {
                 $board->last_post_at = $lastPost->created_at;
                 $board->save();
             }
         }
     });
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:34,代码来源:2015_08_31_021154_adventure_mode.php

示例8: boardStats

 /**
  * Returns the information specified by boardStats
  *
  * @return array (indexes and vales based on $boardStats)
  */
 protected function boardStats()
 {
     $controller =& $this;
     $stats = Cache::remember('index.boardstats', 60, function () use($controller) {
         $stats = [];
         foreach ($controller->boardStats as $boardStat) {
             switch ($boardStat) {
                 case "boardCount":
                     $stats[$boardStat] = Board::whereIndexed()->count();
                     break;
                 case "boardIndexedCount":
                     $stats[$boardStat] = Board::count();
                     break;
                 case "postCount":
                     $stats[$boardStat] = Board::sum('posts_total');
                     break;
                 case "postRecentCount":
                     $stats[$boardStat] = Post::recent()->count();
                     break;
             }
         }
         return $stats;
     });
     return $stats;
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:30,代码来源:BoardStats.php

示例9: getThread

 /**
  * Returns a thread and its replies to the client. 
  *
  * @var Board $board
  * @var integer|null $thread
  * @return Response
  */
 public function getThread(Request $request, Board $board, $thread)
 {
     if (is_null($thread)) {
         return abort(404);
     }
     $input = $request->only('updatesOnly', 'updateHtml', 'updatedSince');
     if (isset($input['updatesOnly'])) {
         $updatedSince = Carbon::createFromTimestamp($request->input('updatedSince', 0));
         $posts = Post::where('posts.board_uri', $board->board_uri)->withEverything()->where(function ($query) use($thread) {
             $query->where('posts.reply_to_board_id', $thread);
             $query->orWhere('posts.board_id', $thread);
         })->where(function ($query) use($updatedSince) {
             $query->where('posts.updated_at', '>=', $updatedSince);
             $query->orWhere('posts.deleted_at', '>=', $updatedSince);
         })->withTrashed()->orderBy('posts.created_at', 'asc')->get();
         if (isset($input['updateHtml'])) {
             foreach ($posts as $post) {
                 $appends = $post->getAppends();
                 $appends[] = "html";
                 $post->setAppends($appends);
             }
         }
         return $posts;
     } else {
         // Pull the thread.
         $thread = $board->getThreadByBoardId($thread);
         if (!$thread) {
             return abort(404);
         }
     }
     return $thread;
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:39,代码来源:BoardController.php

示例10: createBoard

 public function createBoard()
 {
     $table = json_encode([[['state' => 0], ['state' => 0], ['state' => 0]], [['state' => 0], ['state' => 0], ['state' => 0]], [['state' => 0], ['state' => 0], ['state' => 0]]]);
     $board = Board::create(['table' => $table, 'moves' => 0, 'finished' => false]);
     $player1 = Player::create(['user_id' => 1, 'board_id' => $board->id, 'winner' => null]);
     $player2 = Player::create(['user_id' => 1, 'board_id' => $board->id, 'winner' => null]);
     return redirect('/');
 }
开发者ID:NikaBuligini,项目名称:xo,代码行数:8,代码来源:HomeController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $board = Board::find($id);
     if (!$board) {
         return \Response::json(['error' => ['message' => 'Board does not exist']], 404);
     }
     return \Response::json(['data' => $board->toArray()], 200);
 }
开发者ID:kylerdanielster,项目名称:Mello,代码行数:14,代码来源:BoardController.php

示例12: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     $user = User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     // Create the user's personal pinboard
     if ($user) {
         $personalboard = Board::Create(['title' => 'My Personal Activities', 'body' => 'I will do these All Day! Erry Day!', 'shared_with' => 0, 'id_users' => $user->id]);
     }
     return $user;
 }
开发者ID:politicianmemeteam,项目名称:scrubtitles,代码行数:15,代码来源:AuthController.php

示例13: run

 public function run()
 {
     $this->command->info("Seeding boards.");
     if (Board::count() < 1) {
         $board = Board::firstOrCreate(['board_uri' => "test", 'title' => "Test", 'description' => "Discover software features on your own", 'created_by' => 1, 'operated_by' => 1]);
         $this->command->info("Success. At least one board exists now. Accessible at /test/.");
     } else {
         $this->command->info("Skipped. Site has at least one board.");
     }
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:10,代码来源:BoardSeeder.php

示例14: run

 public function run()
 {
     $this->command->info('Seeding role to user associations.');
     $userRoles = [['user_id' => 1, 'role_id' => Role::ID_ADMIN]];
     foreach (Board::get() as $board) {
         $userRoles[] = ['user_id' => $board->operated_by, 'role_id' => $board->getOwnerRole()->role_id];
     }
     foreach ($userRoles as $userRole) {
         UserRole::firstOrCreate($userRole);
     }
 }
开发者ID:Cipherwraith,项目名称:infinity-next,代码行数:11,代码来源:RoleSeeder.php

示例15: patchIndex

 /**
  * Validate and save changes.
  *
  * @return Response
  */
 public function patchIndex(BoardConfigRequest $request, Board $board)
 {
     $input = $request->all();
     $optionGroups = $request->getBoardOptions();
     foreach ($optionGroups as $optionGroup) {
         foreach ($optionGroup->options as $option) {
             $setting = BoardSetting::firstOrNew(['option_name' => $option->option_name, 'board_uri' => $board->board_uri]);
             $option->option_value = $input[$option->option_name];
             $setting->option_value = $input[$option->option_name];
             $setting->save();
         }
     }
     $board->title = $input['boardBasicTitle'];
     $board->description = $input['boardBasicDesc'];
     $board->is_overboard = isset($input['boardBasicOverboard']) && !!$input['boardBasicOverboard'];
     $board->is_indexed = isset($input['boardBasicIndexed']) && !!$input['boardBasicIndexed'];
     $board->is_worksafe = isset($input['boardBasicWorksafe']) && !!$input['boardBasicWorksafe'];
     $board->save();
     Event::fire(new BoardWasModified($board));
     return $this->view(static::VIEW_CONFIG, ['board' => $board, 'groups' => $optionGroups]);
 }
开发者ID:ee-ee,项目名称:infinity-next,代码行数:26,代码来源:ConfigController.php


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