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


PHP Post::select方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $keyword = Input::get('keyword');
     $option = Input::get('search_opt');
     if ($keyword && $option == "fullname") {
         $users = User::where('fullname', 'LIKE', "%{$keyword}%")->get();
         $users_id = array();
         foreach ($users as $key => $user) {
             $users_id[] = $user->id;
         }
         $posts = Post::whereIn('user_id', $users_id)->paginate(5);
     }
     if ($keyword && $option == "content") {
         $posts = Post::select('*')->where($option, 'LIKE', "%{$keyword}%")->paginate(5);
     } else {
         $posts = Post::select('*')->paginate(5);
     }
     return View::make('backend.post.index', compact('posts'));
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:25,代码来源:BEPostController.php

示例2: getData

 /**
  * Show a list of all the blog posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getData()
 {
     $posts = Post::select(array('posts.id', 'posts.title', 'posts.id as comments', 'posts.created_at'));
     return Datatables::of($posts)->edit_column('comments', '{{ DB::table(\'comments\')->where(\'post_id\', \'=\', $id)->count() }}')->add_column('actions', '<a href="{{{ URL::to(\'admin/blogs/\' . $id . \'/edit\' ) }}}" class="btn btn-default btn-xs iframe" >{{{ Lang::get(\'button.edit\') }}}</a>
             <a href="{{{ URL::to(\'admin/blogs/\' . $id . \'/delete\' ) }}}" class="btn btn-xs btn-danger iframe">{{{ Lang::get(\'button.delete\') }}}</a>
         ')->remove_column('id')->make();
 }
开发者ID:sappex,项目名称:viglle_fiji,代码行数:12,代码来源:AdminBlogsController.php

示例3: getData

 /**
  * Show a list of all the blog posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getData()
 {
     $posts = Post::select(array('posts.id', 'posts.title', 'posts.id as comments', 'posts.created_at'));
     return Datatables::of($posts)->edit_column('created_at', '{{ $created_at->format("Y-m-d h:i:s") }}')->edit_column('comments', '{{ DB::table(\'comments\')->where(\'post_id\', \'=\', $id)->count() }}')->add_column('actions', '
         <div class="btn-group">
             <a href="{{{ URL::to(\'admin/blogs/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-xs iframe" ><i class="fa fa-pencil"></i> {{{ Lang::get(\'button.edit\') }}}</a>
             <a href="{{{ URL::to(\'admin/blogs/\' . $id . \'/delete\' ) }}}" class="btn btn-xs btn-danger iframe"><i class="fa fa-trash-o"></i> {{{ Lang::get(\'button.delete\') }}}</a>
         </div>
         ')->remove_column('id')->remove_column('rn')->make();
 }
开发者ID:ariefeko,项目名称:simp,代码行数:15,代码来源:AdminBlogsController.php

示例4: hof

 public function hof()
 {
     $data['page'] = 'halloffame';
     $teams = array();
     // get yg plg aktif di vote
     $total_votes = Vote::select(DB::raw('count(votes.id) as total'), 'teams.name', 'teams.id')->join('users', 'votes.user_id', '=', 'users.id')->join('teams', 'users.team_id', '=', 'teams.id')->groupBy('teams.id')->orderBy('total', 'desc')->take(5)->get();
     if ($total_votes) {
         foreach ($total_votes as $value) {
             $teams[$value->id] = $value->total;
         }
     }
     // get total komen aktif
     $total_comments = Comment::select(DB::raw('count(comments.id) as total'), 'teams.name', 'teams.id')->join('users', 'comments.user_id', '=', 'users.id')->join('teams', 'users.team_id', '=', 'teams.id')->groupBy('teams.id')->orderBy('total', 'desc')->take(5)->get();
     if ($total_comments) {
         foreach ($total_comments as $value) {
             if (isset($teams[$value->id])) {
                 $teams[$value->id] = $teams[$value->id] + $value->total;
             } else {
                 $teams[$value->id] = $value->total;
             }
         }
     }
     // get total post
     $total_posts = Post::select(DB::raw('count(posts.id) as total'), 'teams.name', 'teams.id')->join('users', 'posts.user_id', '=', 'users.id')->join('teams', 'users.team_id', '=', 'teams.id')->groupBy('teams.id')->orderBy('total', 'desc')->take(5)->get();
     if ($total_posts) {
         foreach ($total_posts as $value) {
             if (isset($teams[$value->id])) {
                 $teams[$value->id] = $teams[$value->id] + $value->total;
             } else {
                 $teams[$value->id] = $value->total;
             }
         }
     }
     if (count($teams) > 0) {
         $winningteam = array_search(max($teams), $teams);
         $data['clubwinner'] = Team::find($winningteam);
     } else {
         $data['clubwinner'] = null;
     }
     $startingeleven = array();
     $data['defenders'] = array();
     $data['assisters'] = array();
     $data['attackers'] = array();
     // player
     $defenders = User::select(array('users.id', 'users.username', 'jersey_image', 'jersey_no', 'profile_pic', DB::raw('count(comments.id) as total')))->join('comments', 'users.id', '=', 'comments.user_id')->join('teams', 'teams.id', '=', 'users.team_id')->orderBy('total', 'desc')->groupBy('users.id')->where('comments.type', 'defense')->take(5)->get();
     $assisters = User::select(array('users.id', 'users.username', 'jersey_image', 'jersey_no', 'profile_pic', DB::raw('count(comments.id) as total')))->join('comments', 'users.id', '=', 'comments.user_id')->join('teams', 'teams.id', '=', 'users.team_id')->orderBy('total', 'desc')->groupBy('users.id')->where('comments.type', 'assist')->take(3)->get();
     $attackers = User::select(array('users.id', 'users.username', 'jersey_image', 'jersey_no', 'profile_pic', DB::raw('count(comments.id) as total')))->join('comments', 'users.id', '=', 'comments.user_id')->join('teams', 'teams.id', '=', 'users.team_id')->orderBy('total', 'desc')->groupBy('users.id')->where('comments.type', 'attack')->take(3)->get();
     if ($defenders) {
         foreach ($defenders as $value) {
             $startingeleven[$value->id] = array('name' => $value->username, 'no' => $value->jersey_no, 'pic' => $value->profile_pic, 'jersey_image' => $value->jersey_image, 'total' => $value->total, 'position' => 'D');
         }
     }
     if ($assisters) {
         foreach ($assisters as $value) {
             if (isset($startingeleven[$value->id]) && $startingeleven[$value->id]['total'] > $value->total) {
                 $startingeleven[$value->id] = array('name' => $value->username, 'no' => $value->jersey_no, 'pic' => $value->profile_pic, 'jersey_image' => $value->jersey_image, 'total' => $value->total, 'position' => 'M');
             } else {
                 $startingeleven[$value->id] = array('name' => $value->username, 'no' => $value->jersey_no, 'pic' => $value->profile_pic, 'jersey_image' => $value->jersey_image, 'total' => $value->total, 'position' => 'M');
             }
         }
     }
     if ($attackers) {
         foreach ($attackers as $value) {
             if (isset($startingeleven[$value->id]) && $startingeleven[$value->id]['total'] > $value->total) {
                 $startingeleven[$value->id] = array('name' => $value->username, 'no' => $value->jersey_no, 'pic' => $value->profile_pic, 'jersey_image' => $value->jersey_image, 'total' => $value->total, 'position' => 'F');
             } else {
                 $startingeleven[$value->id] = array('name' => $value->username, 'no' => $value->jersey_no, 'pic' => $value->profile_pic, 'jersey_image' => $value->jersey_image, 'total' => $value->total, 'position' => 'F');
             }
         }
     }
     $noplayer = array('name' => 'No player', 'no' => '0', 'pic' => '', 'jersey_image' => 'player_dummy.png', 'total' => 0);
     if (count($startingeleven) > 0) {
         foreach ($startingeleven as $se) {
             if ($se['position'] == 'F') {
                 array_push($data['attackers'], $se);
             }
             if ($se['position'] == 'M') {
                 array_push($data['assisters'], $se);
             }
             if ($se['position'] == 'D') {
                 array_push($data['defenders'], $se);
             }
         }
         if (count($data['defenders']) < 5) {
             $selisih = 5 - count($data['defenders']);
             for ($i = 0; $i < $selisih; $i++) {
                 array_push($data['defenders'], $noplayer);
             }
         }
         if (count($data['assisters']) < 3) {
             $selisih = 3 - count($data['assisters']);
             for ($i = 0; $i < $selisih; $i++) {
                 array_push($data['assisters'], $noplayer);
             }
         }
         if (count($data['attackers']) < 3) {
             $selisih = 3 - count($data['attackers']);
             for ($i = 0; $i < $selisih; $i++) {
                 array_push($data['attackers'], $noplayer);
             }
//.........这里部分代码省略.........
开发者ID:ChavezRuston,项目名称:fansemo,代码行数:101,代码来源:HomeController.php

示例5: carnival

 public function carnival()
 {
     //return 'We Are Working';
     //Changed
     $data['date'] = $this->getBaseDateTime();
     /*19-May-2015 Ehsan*/
     $user = User::find(Auth::user()->id);
     $url = Picture::find($user->picture);
     $data['self'] = $url;
     /*!!!!19-May-2015 Ehsan*/
     // Everyday Question Generation
     $data['question'] = null;
     $data['prev_question'] = null;
     $question = Question::orderBy('id', 'desc')->first();
     $prev_question = Question::orderBy('id', 'desc')->skip(1)->first();
     if ($question) {
         $data['question'] = $question;
         $data['options_of_question'] = QuestionOption::whereQuestionId($question->id)->get();
         //$get_count_of_the_answers = DB::table('users_answers')->select(DB::raw('option_number,count(*) as count'))->join('question_options','users_answers.option_id', '=', 'question_options.id')->whereQuestionId($question->id)->groupBy('option_id')->groupBy('option_number')->orderBy('option_number')->get();
         $data['answered'] = UsersAnswer::whereUserId(Auth::user()->id)->whereQuestionId($question->id)->first();
     }
     if ($prev_question) {
         $data['prev_question'] = $prev_question;
         $options_of_question = QuestionOption::whereQuestionId($prev_question->id)->get();
         $total_answer = 0;
         foreach ($options_of_question as $key) {
             $current_answer = DB::table('users_answers')->select(DB::raw('count(*) as count'))->whereOptionId($key->id)->first()->count;
             $total_answer += $current_answer;
             $answers_count[$key->option_number] = array('option_details' => $key->option_details, 'total_answer' => $current_answer);
         }
         try {
             foreach ($options_of_question as $key) {
                 $cur = $answers_count[$key->option_number]['total_answer'] * 1.0;
                 $percentage = $cur / $total_answer * 100.0;
                 $answers_count[$key->option_number]['total_answer'] = number_format((double) $percentage, 2, '.', '');
             }
         } catch (Exception $e) {
             $answers_count[1]['total_answer'] = 33;
             $answers_count[2]['total_answer'] = 33;
             $answers_count[3]['total_answer'] = 33;
         }
         $data['total_votes'] = $total_answer;
         $data['answers'] = $answers_count;
     }
     // ENd of Question Related Code
     // Top And Flop Post Generation
     $posts = Post::select('posts.*')->join('users', 'users.id', '=', 'posts.user_id')->where('users.disable', '0')->whereType('3')->orderBy('posts.id', 'desc')->take(30)->lists('id');
     $top_post = DB::table('likes')->select(DB::raw('count(*) as like_count, post_id'))->whereIn('post_id', $posts)->orderBy('like_count', 'desc')->groupBy('post_id')->first();
     // return json_encode($top_post);
     $flop_post = DB::table('dislikes')->select(DB::raw('count(*) as dislike_count, post_id'))->whereIn('post_id', $posts)->orderBy('dislike_count', 'desc')->groupBy('post_id')->first();
     $data['flop_post'] = null;
     $data['top_post'] = null;
     if ($top_post) {
         $post = Post::whereId($top_post->post_id)->first();
         /*19-May-2015 Ehsan*/
         $user = User::find($post->user_id);
         $url = Picture::find($user->picture);
         $url = $url->url;
         /*!!!!19-May-2015 Ehsan*/
         $text = htmlentities($post->post);
         /*Eve-26-May-Ehsan*/
         /*!!!!Eve-26-May-Ehsan*/
         $text = preg_replace('@(https?://([-\\w\\.]+)+(:\\d+)?(/([\\w/_\\.]*(\\?\\S+)?)?)?)@', '<a target="_blank" href="$1">$1</a>', $text);
         $text = preg_replace('/#([a-zA-Z0-9\\x{0980}-\\x{09FF}_])+/u', '<a href="#" class="tags">$0</a>', $text);
         $text = nl2br($text);
         $text = Emojione::shortnameToImage($text);
         $now = Carbon::parse($post->created_at);
         $data['top_post'] = array('id' => $post->id, 'post' => $text, 'user_id' => $post->user_id, 'img' => asset($url), 'like' => Like::wherePostId($post->id)->get()->count(), 'dislike' => Dislike::wherePostId($post->id)->get()->count(), 'liked' => Like::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'disliked' => Dislike::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'comment' => Comment::wherePostId($post->id)->get()->count(), 'ago' => $now->diffForHumans());
     } else {
         $data['top_post'] = null;
     }
     if ($flop_post) {
         $post = Post::whereId($flop_post->post_id)->first();
         /*19-May-2015 Ehsan*/
         $user = User::find($post->user_id);
         $url = Picture::find($user->picture);
         $url = $url->url;
         /*!!!!19-May-2015 Ehsan*/
         $text = htmlentities($post->post);
         /*Eve-26-May-Ehsan*/
         /*!!!!Eve-26-May-Ehsan*/
         $text = preg_replace('@(https?://([-\\w\\.]+)+(:\\d+)?(/([\\w/_\\.]*(\\?\\S+)?)?)?)@', '<a target="_blank" href="$1">$1</a>', $text);
         $text = preg_replace('/#([a-zA-Z0-9\\x{0980}-\\x{09FF}_])+/u', '<a href="#" class="tags">$0</a>', $text);
         $text = nl2br($text);
         $text = Emojione::shortnameToImage($text);
         $now = Carbon::parse($post->created_at);
         $data['flop_post'] = array('id' => $post->id, 'post' => $text, 'user_id' => $post->user_id, 'img' => asset($url), 'like' => Like::wherePostId($post->id)->get()->count(), 'dislike' => Dislike::wherePostId($post->id)->get()->count(), 'liked' => Like::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'disliked' => Dislike::wherePostId($post->id)->whereUserId(Auth::user()->id)->get()->count(), 'comment' => Comment::wherePostId($post->id)->get()->count(), 'ago' => $now->diffForHumans());
     } else {
         $data['flop_post'] = null;
     }
     // Top And Flop Post Generation end
     // Get All Available Reports and Feelings
     $data['feelings'] = Feeling::get();
     $data['reports'] = Report::get();
     //
     $data['notifications'] = $this->getNotification();
     //Get Current Trends
     $now = Carbon::now();
     $before_12hours = Carbon::now()->subHours(12);
     $data['tags'] = DB::table('hash_tagged_posts')->select('tag_id', 'tag', DB::raw('count(*) as  count'))->join('hashtags', 'hashtags.id', '=', 'hash_tagged_posts.tag_id')->whereIn('hash_tagged_posts.post_id', function ($query) {
//.........这里部分代码省略.........
开发者ID:nayeemjoy,项目名称:maskcamp,代码行数:101,代码来源:UsersController.php

示例6: Connect

<?php

require_once __DIR__ . '/Model.php';
require_once __DIR__ . '/Connect.php';
require_once __DIR__ . '/Post.php';
require_once __DIR__ . '/User.php';
$database = ['dsn' => 'mysql:host=localhost;dbname=ecole_multimedia', 'password' => 'root', 'username' => 'antoine'];
$connect = new Connect($database);
/* ------------------------------------------------- *\
    Name of Model $postModel or $userModel ...
\* ------------------------------------------------- */
$postModel = new Post($connect->getDB());
var_dump($postModel->count());
$posts = $postModel->select(['title', 'status', 'content'])->where('id', '>', 1)->where('status', '=', 'published')->get();
foreach ($posts as $post) {
    echo "<h1>{$post->title}</h1>";
}
/* ------------------------------------------------- *\
    Count method
\* ------------------------------------------------- */
var_dump($postModel->count());
var_dump($postModel->where('id', '>', 1)->count());
/* ------------------------------------------------- *\
    Method all
\* ------------------------------------------------- */
var_dump($postModel->all());
$posts = $postModel->all();
foreach ($posts as $post) {
    echo "<h1>{$post->title}...</h1>";
}
/* ------------------------------------------------- *\
开发者ID:Antoine07,项目名称:Base-Objet,代码行数:31,代码来源:test.php

示例7: ajaxGetNextPage

 public function ajaxGetNextPage($type, $page)
 {
     $skip = $page * 12;
     switch ($type) {
         case 'fresh':
             $images = Post::orderBy('created_at', 'desc');
             break;
         case 'mine':
             $images = Post::where('user_id', Auth::id())->orderBy('created_at', 'desc');
             break;
         case 'trending':
             $images = Post::select('posts.*', DB::raw('count(votes.id) as total'))->leftJoin('votes', 'posts.id', '=', 'votes.post_id')->groupBy('posts.id')->orderBy('total', 'desc');
             break;
         default:
             $userid = explode('_', $type);
             $userid = $userid[1];
             $images = Post::where('user_id', $userid)->orderBy('created_at', 'desc');
             break;
     }
     if (Auth::user()) {
         $images = $images->with(array('votes' => function ($query) {
             $query->where('user_id', Auth::id());
         }));
     }
     $images = $images->skip($skip)->take(12)->get();
     $result = '';
     if ($images->count() > 0) {
         foreach ($images as $img) {
             if (isset($img->votes)) {
                 if (!empty($img->votes->first()) && $img->votes->first()->type == "like") {
                     $classlike = 'activeAct like';
                 } else {
                     $classlike = 'like';
                 }
                 if (!empty($img->votes->first()) && $img->votes->first()->type == 'dislike') {
                     $classdislike = 'activeAct dislike';
                 } else {
                     $classdislike = 'dislike';
                 }
                 $buttons = '<a href="#" class="' . $classlike . '" data-id="' . $img->id . '"><i class="fa fa-thumbs-up"></i></a>
                       <a href="#" class="' . $classdislike . '" data-id="' . $img->id . '"><i class="fa fa-thumbs-down"></i></a>';
             } else {
                 $buttons = '<a class="disabledlike" data-toggle="modal" data-target="#modalSignin"><i class="fa fa-thumbs-up"></i></a>
                       <a class="disabledlike" data-toggle="modal" data-target="#modalSignin"><i class="fa fa-thumbs-down"></i></a>';
             }
             $attack = Comment::where('post_id', $img->id)->where('type', 'attack')->count();
             $assist = Comment::where('post_id', $img->id)->where('type', 'assist')->count();
             $defense = Comment::where('post_id', $img->id)->where('type', 'defense')->count();
             $result = $result . '<div class="col-sm-12">
                 <a href="' . url('post/' . $img->slug) . '"><h3 class="text-left mtm0">' . str_limit($img->title, $limit = 50, $end = '...') . '</h3></a>
                 <div class="imageBox">
                   <a href="' . url('post/' . $img->slug) . '"><img src="' . url('imgpost/' . $img->user_id . '/' . $img->image) . '" alt="' . $img->title . '" title="' . $img->title . '"></a>
                 </div><!-- imageBox -->
                 <div class="row infoBarTrend mt10 text-left">
                   <div class="leftBarTrend pull-left col-sm-7 col-xs-12">
                     <p class="inlineB">' . Vote::where('post_id', $img->id)->where('type', 'like')->count() . ' likes</p>
                     <p class="inlineB ml10">' . Vote::where('post_id', $img->id)->where('type', 'dislike')->count() . ' dislikes</p>
                     <p class="inlineB ml10">' . Comment::where('post_id', $img->id)->count() . ' comments</p>
                     <div class="actionRow">
                       ' . $buttons . '
                       <a href="' . url('post/' . $img->slug) . '"><i class="fa fa-comment"></i></a>
                     </div><!-- actionRow -->
                   </div><!-- leftBarTrend -->
                   <div class="rightBarTrend pull-right col-sm-5 col-xs-12">
                     <p><img src="' . asset('images/icon_attack.jpg') . '" alt="icon_attack"><span class="clrGrey"> Attack: </span><span> ' . $attack . ' </span> points</p>
                     <p><img src="' . asset('images/icon_defense.jpg') . '" alt="icon_defense"><span class="clrGrey"> Defense: </span><span> ' . $assist . ' </span> points</p>
                     <p><img src="' . asset('images/icon_assist.jpg') . '" alt="icon_assist"><span class="clrGrey"> Assist: </span><span> ' . $defense . ' </span> points</p>
                   </div><!-- rightBarTrend -->
                 </div><!-- infoBarTrend -->
               </div>';
         }
         $nextpage = $page + 1;
         $result = $result . '<div class="col-sm-12 mt30 mb40"><a href="' . url('next/' . $type . '/' . $nextpage) . '" class="btn btn-default">Load More</a></div>';
     }
     return $result;
 }
开发者ID:ChavezRuston,项目名称:fansemo,代码行数:76,代码来源:PostController.php

示例8: approve

 public function approve($user_id, $ip_addr)
 {
     self::connection()->executeSql("UPDATE tag_aliases SET is_pending = FALSE WHERE id = ?", $this->id);
     Post::select('posts.*')->joins('JOIN posts_tags pt ON posts.id = pt.post_id JOIN tags ON pt.tag_id = tags.id')->where("tags.name LIKE ?", $this->name)->take()->each(function ($post) use($user_id, $ip_addr) {
         $post->reload();
         $post->updateAttributes(['tags' => $post->cached_tags, 'updater_user_id' => $user_id, 'updater_ip_addr' => $ip_addr]);
     });
     Moebooru\CacheHelper::expire_tag_version();
 }
开发者ID:JCQS04,项目名称:myimouto,代码行数:9,代码来源:TagAlias.php

示例9: listing_ajax

 /**
  * function for send ajax request to view
  *
  * @return Response
  */
 public function listing_ajax()
 {
     $query = Post::select('id', 'title', 'user_id', 'category_id', 'created_at', 'show')->get();
     return Datatable::collection($query)->addColumn('title', function ($model) {
         return '<a href="' . action('AdminPostsController@edit', $model->id) . '">' . $model->title . '</a>';
     })->addColumn('author', function ($model) {
         return $model->user->name;
     })->addColumn('show', function ($model) {
         return $model->show == 0 ? 'Unpublished' : 'Published';
     })->addColumn('category', function ($model) {
         return $model->category->name;
     })->showColumns('created_at')->addColumn('edit', function ($model) {
         return '<a href="' . action('AdminPostsController@edit', $model->id) . '" class="btn btn-success btn-constant"><i class="fa fa-edit fa-fw"></i>Edit</a>';
     })->addColumn('delete', function ($model) {
         return '<form action="' . action('AdminPostsController@delete', $model->id) . '" method="POST"><button type="submit" class="btn btn-danger btn-constant" onclick = "return confirm(\'Are you sure?\')"><i class="fa fa-times fa-fw"></i>Delete</button></form>';
     })->searchColumns('title', 'category')->orderColumns('id', 'title', 'created_at', 'category')->make();
 }
开发者ID:syafdia,项目名称:PAS,代码行数:22,代码来源:AdminPostsController.php

示例10: getData

 /**
  * Show a list of all the blog posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getData()
 {
     $posts = Post::select(array('posts.id', 'posts.title', 'posts.id as comments', 'posts.created_at'));
     if (Api::Enabled()) {
         $u = $posts->get();
         return Api::make($u->toArray());
     } else {
         return Datatables::of($posts)->edit_column('comments', '{{ DB::table(\'comments\')->where(\'post_id\', \'=\', $id)->count() }}')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/slugs/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-sm modalfy" >{{{ Lang::get(\'button.edit\') }}}</a>
             <a data-method="delete" data-row="{{{  $id }}}" data-table="blogs"  href="{{{ URL::to(\'admin/slugs/\' . $id . \'\' ) }}}" class="ajax-alert-confirm btn btn-sm btn-danger">{{{ Lang::get(\'button.delete\') }}}</a></div>
         ')->make();
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:17,代码来源:AdminBlogsController.php

示例11: blogShow

 public function blogShow()
 {
     $blogs = Post::select('id', 'title', 'body')->paginate(10);
     return View::make('blog.show')->with('blogs', $blogs);
 }
开发者ID:phyowailinn,项目名称:lara-vel,代码行数:5,代码来源:HomeController.php


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