本文整理汇总了PHP中Activity::whereRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::whereRaw方法的具体用法?PHP Activity::whereRaw怎么用?PHP Activity::whereRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::whereRaw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postPolling
public function postPolling()
{
$polls = json_decode(Input::get('polls'));
$_results = array();
if (is_array($polls) && count($polls) > 0) {
foreach ($polls as $i => $_poll) {
switch ($_poll->type) {
case "plugin":
if ($_poll->func) {
$_results[$_poll->id] = call_user_func($_poll->func, $_poll->value);
}
break;
case "check_logs":
$list = Activity::whereRaw('UNIX_TIMESTAMP(`activity_log`.`created_at`) > ? AND (activity_log.content_type="notification" OR activity_log.content_type="login")', array(Session::get('usersonline_lastcheck', time())))->select(array('description', 'details', 'users.displayname', 'content_type'))->groupBy(DB::raw('description, details, users.displayname, content_type'))->orderBy('activity_log.id', 'DESC')->leftJoin('users', 'users.id', '=', 'activity_log.user_id')->get()->toArray();
Session::put('usersonline_lastcheck', time());
$_results[$_poll->id] = array('type' => 'function', 'func' => 'fnUpdateGrowler', 'args' => $list);
break;
case "users_online":
$_results[$_poll->id] = array('type' => 'html', 'args' => Theme::make('admin/helpers/users-online')->render());
break;
}
}
}
return Response::json($_results);
}
示例2: activity
public static function activity()
{
return Activity::whereRaw('UNIX_TIMESTAMP(`activity_log`.`created_at`) > ? AND (activity_log.content_type="notification" OR activity_log.content_type="login")', array(Session::get('usersonline_lastcheck', time())))->select(array('description', 'details', 'users.displayname', 'content_type'))->groupBy(DB::raw('description, details, users.displayname, content_type'))->orderBy('activity_log.id', 'DESC')->leftJoin('users', 'users.id', '=', 'activity_log.user_id')->get()->toArray();
}
示例3: getEdit
/**
* edit user
*
* @return Response
*/
public function getEdit($user)
{
if ($user->id) {
$roles = $this->role->all();
$profiles = $user->profiles;
$permissions = $this->permission->all();
$title = Lang::get('admin/users/title.user_update');
$mode = 'edit';
$last_login = Activity::whereRaw('user_id = ? AND content_type="login"', array($user->id))->select(array('details'))->orderBy('id', 'DESC')->first();
return Theme::make('admin/users/create_edit', compact('user', 'roles', 'permissions', 'title', 'mode', 'profiles', 'last_login'));
} else {
return Api::to(array('error', Lang::get('admin/users/messages.does_not_exist'))) ?: Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.does_not_exist'));
}
}
示例4: getEmails
public function getEmails($user)
{
if ($user->id) {
$list = Activity::whereRaw('user_id = ? AND content_type="email"', array($user->id))->select(array('user_id', 'description', 'details', 'ip_address', 'updated_at'))->orderBy('id', 'DESC');
if (Api::Enabled()) {
$u = $list->get();
return $u->toArray();
} else {
return Datatables::of($list)->edit_column('updated_at', '{{{ Carbon::parse($updated_at)->diffForHumans() }}}')->edit_column('details', '{{{ strip_tags(substr($details,0,100))}}}')->make();
}
}
}
示例5: activity
public function activity()
{
return Activity::whereRaw('user_id = ? AND content_type="activity"', array($this->id))->select(array('user_id', 'description', 'details', 'ip_address', 'updated_at'))->orderBy('id', 'DESC');
}