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


PHP Point::where方法代码示例

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


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

示例1: existed

 public function existed($pointable_type, $pointable_id, $issue_id)
 {
     $countMe = Point::where('pointable_type', '=', $pointable_type)->where('pointable_id', '=', $pointable_id)->where('issue_id', '=', $issue_id)->count();
     if ($countMe > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:9,代码来源:PointsController.php

示例2: add_daily_comment_points

 private function add_daily_comment_points()
 {
     $user_id = Auth::user()->id;
     $LastCommentPoints = Point::where('user_id', '=', $user_id)->where('description', '=', Lang::get('lang.daily_comment'))->orderBy('created_at', 'desc')->take(5)->get();
     $total_daily_comments = 0;
     foreach ($LastCommentPoints as $CommentPoint) {
         if (date('Ymd') == date('Ymd', strtotime($CommentPoint->created_at))) {
             $total_daily_comments += 1;
         }
     }
     if ($total_daily_comments < 5) {
         $point = new Point();
         $point->user_id = $user_id;
         $point->description = Lang::get('lang.daily_comment');
         $point->points = 1;
         $point->save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:giangcoffee,项目名称:ninja,代码行数:21,代码来源:CommentsController.php

示例3: points

 public function points($username)
 {
     $user = User::where('username', '=', $username)->first();
     if (!Auth::guest() && Auth::user()->id == $user->id) {
         $is_user_profile = true;
     }
     $user_points = DB::table('points')->where('user_id', '=', $user->id)->sum('points');
     $data = array('user' => $user, 'points' => Point::where('user_id', '=', $user->id)->get(), 'settings' => Setting::first(), 'is_user_profile' => $is_user_profile, 'user_points' => $user_points);
     return View::make('Theme::user', $data);
 }
开发者ID:nvq247,项目名称:Kxexnxh,代码行数:10,代码来源:UserController.php

示例4: recharge

 public function recharge()
 {
     $v = Validator::make(Input::all(), ["code" => "required|size:22"], ["required" => "<span class='glyphicon glyphicon-exclamation-sign'></span> Please typr the code.", "size" => "<span class='glyphicon glyphicon-exclamation-sign'></span> Invalid code"]);
     if ($v->fails()) {
         return Redirect::back()->withErrors($v)->withInput();
     }
     $find = Product::where("code", Input::get("code"));
     if ($find->count() > 0) {
         // Give the point associated with the code
         $point = $find->get()->first()->point;
         $p = new Point();
         $p->user_id = Auth::user()->id;
         $p->point = $point;
         $p->product_id = $find->get()->first()->id;
         $p->save();
         // Set user's designation
         $active_member = User::find(Auth::user()->id);
         $active_member->designation = "Active member";
         $active_member->save();
         // Remove the code from product. So that any user can't use the same code twice.
         $find->update(["code" => ""]);
         // If the user has 1000 points then add amount 500
         $how_many_points = Point::where('user_id', Auth::user()->id)->sum('point');
         if ($how_many_points >= 1000) {
             // Set the user's designation to Model member
             $model_member = User::find(Auth::user()->id);
             $model_member->designation = "Model member";
             $model_member->save();
             // Check the user's referal is an admin or not
             $my_referal = User::find(Auth::user()->referal_id);
             if ($my_referal->type == 'admin') {
                 $distributed_amount = 600;
             } else {
                 $distributed_amount = 300;
             }
             Amount::create(['user_id' => Auth::user()->id, 'amount' => 500, 'status' => 1]);
             Amount::create(['user_id' => Auth::user()->referal_id, 'amount' => $distributed_amount]);
             Point::where('user_id', Auth::user()->id)->delete();
         }
         return Redirect::back()->with("event", "<p class='alert alert-success'><span class='glyphicon glyphicon-ok'></span> Congratulation! You got " . $point . " points.</p>");
     }
     return Redirect::back()->with("event", "<p class='alert alert-danger'><span class='glyphicon glyphicon-exclamation-sign'></span> Invalid code.</p>");
 }
开发者ID:jorzhikgit,项目名称:MLM-Nexus,代码行数:43,代码来源:UserController.php

示例5: points

 public function points($username)
 {
     $user = User::where('username', '=', $username)->first();
     $data = array('user' => $user, 'points' => Point::where('user_id', '=', $user->id)->get());
     return View::make('user.points', $data);
 }
开发者ID:giangcoffee,项目名称:ninja,代码行数:6,代码来源:UserController.php

示例6: getHighest

 private function getHighest($event)
 {
     $highest = Point::where('pointable_type', '=', 'Activity')->where('pointable_id', '=', $event)->max('point');
     return $highest;
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:5,代码来源:StudentsController.php


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