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


PHP Comment::all方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $id = Auth::id();
     $comment_data = Comment::all();
     foreach ($comment_data as $comment) {
         $user_id = $comment['user_id'];
         $user = User::getUserById($user_id);
         $comment['username'] = $user['username'];
         $comment['email'] = $user['email'];
         $post = Post::getPostById($comment["post_id"]);
         $comment['title'] = $post['title'];
         $format = "F j, Y, g:i a";
         $date = new DateTime($post['updated_at']);
         $formatDate = $date->format($format);
         $comment['update_time'] = $formatDate;
         if (isset($user['fb_img'])) {
             $comment['fb_img'] = $user['fb_img'];
         }
         if ($comment["user_id"] == $id) {
             $comment["owner"] = true;
         } else {
             $comment["owner"] = false;
         }
     }
     return Response::json($comment_data);
 }
开发者ID:Hungmaix94,项目名称:Medusa,代码行数:32,代码来源:CommentController.php

示例2: comments

 public function comments()
 {
     //$media = MediaFlag::groupBy('media_id')->get();
     $comments = Comment::all();
     $data = array('comments' => $comments);
     return View::make('admin.sections.comments', $data);
 }
开发者ID:phanhung0906,项目名称:demo1,代码行数:7,代码来源:AdminController.php

示例3: testGetListCommentSuccessNoComment

 public function testGetListCommentSuccessNoComment()
 {
     $comment = Comment::destroy(1);
     $response = $this->call('GET', 'api/comment/1');
     $comment_infor = Comment::all();
     $this->assertEquals(array("code" => ApiResponse::OK, "data" => $comment_infor->toArray()), json_decode($response->getContent(), true));
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:7,代码来源:CommentTest.php

示例4: comments_list

 /**
  * Comments list
  *
  * @param $request
  * @return mixed
  */
 public function comments_list($request)
 {
     // Delete page
     if ($request->get('delete')) {
         $delete = $request->get('delete');
         if ($delete != 'all') {
             $comment = \Comment::find_by_id(intval($delete));
             if ($comment) {
                 // Delete child comments
                 \Comment::table()->delete('parent_id = ' . $comment->id);
                 if ($comment->delete()) {
                     $this->view->assign('message', $this->lang->translate('form.deleted'));
                 }
             }
         } else {
             \Comment::table()->delete('1');
             $this->view->assign('message', $this->lang->translate('form.deleted'));
         }
     }
     // Filter
     $filter = [];
     if ($request->get('author')) {
         $author = \User::find($request->get('author'));
         if ($author) {
             $filter['conditions'] = ['author_id = ?', $author->id];
         }
     }
     $filter['order'] = 'id DESC';
     if ($request->order) {
         $filter['order'] = $request->order;
     }
     /** @var Listing $paginator */
     $paginator = NCService::load('Paginator.Listing', [$request->page, \Comment::count('all')]);
     $filter = array_merge($filter, $paginator->limit());
     // Filter users
     $comments = \Comment::all($filter);
     $comments = \Comment::as_array($comments);
     return $this->view->render('comment/list.twig', ['title' => $this->lang->translate('comment.list'), 'comments_list' => $comments, 'listing' => $paginator->pages(), 'page' => $paginator->cur_page]);
 }
开发者ID:Max201,项目名称:nanocore,代码行数:45,代码来源:Control.php

示例5: function

|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    Route::get('/', 'HomeController@index')->middleware('guest');
    // Article Route
    Route::group(['middleware' => 'admin'], function () {
        Route::get('/articles/create', 'ArticlesController@create');
        Route::post('/articles', 'ArticlesController@store');
        Route::get('articles/{slug}/edit', 'ArticlesController@edit');
        Route::post('/articles/{slug}', 'ArticlesController@update');
        Route::delete('/articles/{slug}', 'ArticlesController@destroy');
    });
    Route::get('/articles', 'ArticlesController@index');
    Route::get('/articles/{slug?}', 'ArticlesController@show');
    // Comment Route
    Route::post('/articles/{slug?}/comment', 'CommentsController@store');
    Route::get('/articles/comment', function () {
        $comments = Comment::all();
        dd($comments);
        return null;
    });
    // Card Route
    Route::get('/cards/{username}', 'CardsController@index')->middleware('auth');
    Route::post('/cards/{username}', 'CardsController@update')->middleware('auth');
});
开发者ID:bambangsusanto,项目名称:divkomapp,代码行数:31,代码来源:routes.php

示例6: function

<?php

use App\Storage\{Comment\Comment, Post\Post, User\User};
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(User::class, function ($faker) {
    return ['name' => str_replace('.', '_', $faker->userName), 'email' => $faker->unique()->email, 'password' => bcrypt('secret')];
});
$factory->defineAs(User::class, 'admin', function ($faker) use($factory) {
    $user = $factory->raw(User::class);
    return array_merge($user, ['role' => 'admin']);
});
$factory->define(Post::class, function ($faker) {
    $title = $faker->unique()->sentence;
    return ['title' => $title, 'content' => $faker->realText(5000), 'slug' => str_slug($title), 'user_id' => User::all()->random()->id, 'published_at' => $faker->dateTimeBetween('-1 month', '+15 days')];
});
$factory->define(Comment::class, function ($faker) {
    return ['post_id' => Post::published()->get()->random()->id, 'user_id' => User::all()->random()->id, 'body' => $faker->realText(500)];
});
$factory->defineAs(Comment::class, 'reply', function ($faker) use($factory) {
    $comment = $factory->raw(Comment::class);
    return array_merge($comment, ['parent_id' => Comment::all()->random()->id]);
});
开发者ID:adiachenko,项目名称:catchy_api,代码行数:31,代码来源:ModelFactory.php

示例7: getComment

 public function getComment()
 {
     $comments = Comment::all();
     return View::make('admin.comments.index')->with('comments', $comments);
 }
开发者ID:RybinDen,项目名称:laravel-blog,代码行数:5,代码来源:AdminController.php

示例8: getComments

 public function getComments()
 {
     return Comment::all(['article_id' => $this->id]);
 }
开发者ID:AJIACTOP,项目名称:MVC-Framework,代码行数:4,代码来源:Article.php

示例9: index

 /**
  * Display a listing of comments
  *
  * @return Response
  */
 public function index()
 {
     $comments = Comment::all();
     return View::make('comments.index', compact('comments'));
 }
开发者ID:automotivecapstone,项目名称:capstone.dev,代码行数:10,代码来源:CommentsController.php

示例10: comments

 public function comments()
 {
     $this->load->library('pagination');
     $comments = Comment::all();
     $config['base_url'] = base_url() . 'dashboard/comments/page/';
     $config['total_rows'] = $comments->count();
     $config['per_page'] = 5;
     $skip = ($this->uri->segment(4) - 1) * $config['per_page'];
     $this->pagination->initialize($config);
     $data = ['menu' => 'comments', 'comments' => Comment::skip($skip)->take($config['per_page'])->get(), 'links' => $this->pagination->create_links(), 'row' => $this->uri->segment(4) ? $config['per_page'] * ($this->uri->segment(4) - 1) : 0];
     $this->load->view('dashboard/comments', $data);
 }
开发者ID:harithaakella,项目名称:my_new_blog,代码行数:12,代码来源:Dashboard.php

示例11: comment

 public function comment()
 {
     $comments = Comment::all();
     $act = 'list';
     $no = 0;
     return View::make('admin.comment', compact('comments', 'act', 'no'));
 }
开发者ID:beruxganteng,项目名称:repository-djpbn,代码行数:7,代码来源:BackendController.php

示例12: getIndex

 public function getIndex()
 {
     $comments = Comment::all();
     return View::make('admin.teacher.comments.commentIndex')->with(compact('comments'));
 }
开发者ID:resethread,项目名称:elycee,代码行数:5,代码来源:CommentsController.php

示例13: build_backend_subactions

function build_backend_subactions()
{
    global $backend_subactions, $pluginpages_handlers;
    $backend_subactions = url_action_subactions(array("_index" => url_action_alias(array("login")), "index" => url_action_alias(array("login")), "_prelude" => function (&$data, $url_now, &$url_next) {
        global $ratatoeskr_settings, $admin_grp, $ste, $languages;
        if ($admin_grp === NULL) {
            $admin_grp = Group::by_name("admins");
        }
        $ste->vars["all_languages"] = array();
        $ste->vars["all_langcodes"] = array();
        foreach ($languages as $code => $data) {
            $ste->vars["all_languages"][$code] = $data["language"];
            $ste->vars["all_langcodes"][] = $code;
        }
        ksort($ste->vars["all_languages"]);
        sort($ste->vars["all_langcodes"]);
        /* Check authentification */
        if (isset($_SESSION["ratatoeskr_uid"])) {
            try {
                $user = User::by_id($_SESSION["ratatoeskr_uid"]);
                if ($user->pwhash == $_SESSION["ratatoeskr_pwhash"] and $user->member_of($admin_grp)) {
                    if (empty($user->language)) {
                        $user->language = $ratatoeskr_settings["default_language"];
                        $user->save();
                    }
                    load_language($user->language);
                    if ($url_next[0] == "login") {
                        $url_next = array("content", "write");
                    }
                    $data["user"] = $user;
                    $ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
                    return;
                    /* Authentification successful, continue  */
                } else {
                    unset($_SESSION["ratatoeskr_uid"]);
                }
            } catch (DoesNotExistError $e) {
                unset($_SESSION["ratatoeskr_uid"]);
            }
        }
        load_language();
        /* If we are here, user is not logged in... */
        $url_next = array("login");
    }, "login" => url_action_simple(function ($data) {
        global $ste, $admin_grp;
        if (!empty($_POST["user"])) {
            try {
                $user = User::by_name($_POST["user"]);
                if (!PasswordHash::validate($_POST["password"], $user->pwhash)) {
                    throw new Exception();
                }
                if (!$user->member_of($admin_grp)) {
                    throw new Exception();
                }
                /* Login successful. */
                $_SESSION["ratatoeskr_uid"] = $user->get_id();
                $_SESSION["ratatoeskr_pwhash"] = $user->pwhash;
                load_language($user->language);
                $data["user"] = $user;
                $ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
            } catch (Exception $e) {
                $ste->vars["login_failed"] = True;
            }
            if (isset($data["user"])) {
                throw new Redirect(array("content", "write"));
            }
        }
        echo $ste->exectemplate("/systemtemplates/backend_login.html");
    }), "logout" => url_action_simple(function ($data) {
        unset($_SESSION["ratatoeskr_uid"]);
        unset($_SESSION["ratatoeskr_pwhash"]);
        load_language();
        throw new Redirect(array("login"));
    }), "content" => url_action_subactions(array("write" => function (&$data, $url_now, &$url_next) {
        global $ste, $translation, $textprocessors, $ratatoeskr_settings, $languages, $articleeditor_plugins;
        list($article, $editlang) = array_slice($url_next, 0);
        if (!isset($editlang)) {
            $editlang = $data["user"]->language;
        }
        if (isset($article)) {
            $ste->vars["article_editurl"] = urlencode($article) . "/" . urlencode($editlang);
        } else {
            $ste->vars["article_editurl"] = "";
        }
        $url_next = array();
        $default_section = Section::by_id($ratatoeskr_settings["default_section"]);
        $ste->vars["section"] = "content";
        $ste->vars["submenu"] = isset($article) ? "articles" : "newarticle";
        $ste->vars["textprocessors"] = array();
        foreach ($textprocessors as $txtproc => $properties) {
            if ($properties[1]) {
                $ste->vars["textprocessors"][] = $txtproc;
            }
        }
        $ste->vars["sections"] = array();
        foreach (Section::all() as $section) {
            $ste->vars["sections"][] = $section->name;
        }
        $ste->vars["article_section"] = $default_section->name;
        /* Check Form */
//.........这里部分代码省略.........
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:101,代码来源:backend.php

示例14: getComments

 public function getComments($parent)
 {
     return Comment::all(array('conditions' => array('video_id = ? AND parent = ?', $this->id, $parent), 'order' => 'timestamp desc'));
 }
开发者ID:agiza,项目名称:DreamVids,代码行数:4,代码来源:video.php

示例15: site_url

									<div class="clearfix"></div>
								</div>
							</a>
						</div> <!-- /. panel-primary -->
					</div> <!-- /. col-lg-3 -->
					
					<div class="col-lg-3 col-md-6">
						<div class="panel panel-green">
							<div class="panel-heading">
								<div class="row">
									<div class="col-xs-3">
									<i class="fa fa-comments fa-5x"></i>
									</div>
									<div class="col-xs-9 text-right">
									<div class="huge"><?php 
echo Comment::all()->count();
?>
</div>
										<div>Total Comments!</div>
									</div>
								</div>
							</div>
							<a href="<?php 
echo site_url('dashboard/comments');
?>
">
								<div class="panel-footer">
									<span class="pull-left">View Details</span>
									<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
									<div class="clearfix"></div>
								</div>
开发者ID:harithaakella,项目名称:my_new_blog,代码行数:31,代码来源:index.php


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