當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Board::byUserId方法代碼示例

本文整理匯總了PHP中Board::byUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Board::byUserId方法的具體用法?PHP Board::byUserId怎麽用?PHP Board::byUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Board的用法示例。


在下文中一共展示了Board::byUserId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: showBoards

 public function showBoards()
 {
     if (Auth::check()) {
         $user = Auth::user();
         $data['user'] = $user;
         $data['boards'] = Board::byUserId($user);
         if ($user->level == 1) {
             $data['width'] = $data['boards']->count() / 1 * 100;
             $data['max'] = 1;
         } else {
             if ($user->level == 2) {
                 $data['width'] = $data['boards']->count() / 5 * 100;
                 $data['max'] = 5;
             }
         }
         $data['title'] = $this->layout->title = 'Tablice';
         $this->layout->user = $user;
         $this->layout->content = View::make('user.boards', $data);
     }
 }
開發者ID:itsfamestudio,項目名稱:hashtag,代碼行數:20,代碼來源:UserController.php

示例2: showBoard

 public function showBoard($query, $id = NULL, $presentation = NULL)
 {
     Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js', 'footer');
     Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js', 'footer');
     Asset::add('/js/libs/jquery.dropdown.js', 'footer');
     //Asset::add('/js/posts.js', 'footer');
     Asset::add('/js/posts-new.js', 'footer');
     //check if board exists
     if (strlen($query) > 2) {
         $query = explode(' ', trim($query));
         $result = preg_replace('/#([\\w-]+)/i', '$1', $query[0]);
         $query = Sanitize::string($result);
     } else {
         App::abort(404);
     }
     if (isset($id)) {
         $board = Board::find($id);
         if (!is_null($board)) {
             if ($board->hashtag != $query || $board->config()->first()->user_id == 0) {
                 App::abort(404);
             }
         } else {
             App::abort(404);
         }
     } else {
         $board = Board::where('hashtag', '=', $query)->whereHas('config', function ($q) {
             $q->where('user_id', '=', 0);
         })->first();
         if (is_null($board)) {
             $board = Board::create(array('hashtag' => $query));
             $visit = Visit::create(array('ip' => Request::ip()));
             $config = BoardConfig::create(array('board_id' => $board->id));
         }
     }
     if ($board->config()->first()->is_active == 1) {
         if (!is_null($board->cover_file_name)) {
             $data['layout'] = $this->layout->cover = 'with-cover';
         } else {
             $data['layout'] = $this->layout->cover = 'no-cover';
         }
         if (Auth::check()) {
             $user = Auth::user();
             $data['username'] = preg_replace('/@.*?$/', '', $user->email);
             $data['userBoards'] = Board::byUserId($user)->orderBy('created_at', 'asc')->get();
             $data['user'] = $user;
             if ($user->id == $board->config()->first()->user_id) {
                 $userOwned = true;
             }
             if (!is_null($user->provider()->first()) && $user->provider()->first()->provider == 'facebook') {
                 $data['avatar'] = '<img src="http://graph.facebook.com/' . $user->provider()->first()->provider_id . '/picture?type=small" alt="avatar" />';
             }
         }
         if (Session::get('session-stat') != $board->id) {
             $stats = Stat::firstOrCreate(array('board_id' => $board->id))->increment('hits');
             Session::put('session-stat', $board->id);
         }
         $data['board'] = $board;
         $data['boardData'] = $this->layout->boardData = $board;
         $data['title'] = $this->layout->title = $board->hashtag;
         $data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '');
         if (isset($presentation) && $presentation != 'live') {
             App::abort(404);
         }
         if (isset($id) && $presentation == 'live' && $board->config()->first()->presentation == 1) {
             $data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '') . ' board-presentation';
             $this->layout->content = View::make('boards.board-presentation', $data);
         } else {
             $this->layout->content = View::make('boards.index', $data);
         }
     } else {
         App::abort(404);
     }
 }
開發者ID:itsfamestudio,項目名稱:hashtag,代碼行數:73,代碼來源:BoardsController.php


注:本文中的Board::byUserId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。