本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
示例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>");
}
示例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);
}
示例6: getHighest
private function getHighest($event)
{
$highest = Point::where('pointable_type', '=', 'Activity')->where('pointable_id', '=', $event)->max('point');
return $highest;
}