/** * parse username to get userid * */ protected function getUserId($username) { if (starts_with($username, "@:")) { return substr($username, 2); } return \Veer\Models\User::where('username', '=', substr($username, 1))->pluck('id'); }
/** * Increment Orders Counts */ protected function incrementOrdersCount($users_id) { \Veer\Models\User::where('id', '=', $users_id)->increment('orders_count'); }
/** * Query Builder: * * - who: 1 User * - with: * - to whom: make() | user/{id} * * @later: 'role', 'comments', 'books', 'discounts', 'userlists', 'orders', 'bills', * 'communications', 'administrator', 'searches', 'pages'* */ public function getUserWithSite($siteId, $id) { return \Veer\Models\User::where('id', '=', $id)->where('sites_id', '=', $siteId)->where('banned', '!=', '1')->first(); }
/** * @param array $data * @return \Veer\Services\Administration\Elements\User */ public function updateBan($data) { if (is_array($data) && !empty($data) && key($data) != \Auth::id()) { \Veer\Models\User::where('id', '=', key($data))->update(['banned' => head($data)]); if (head($data) == true) { \Veer\Models\UserAdmin::where('users_id', '=', key($data))->update(['banned' => head($data)]); } event('veer.message.center', trans('veeradmin.user.ban')); } return $this; }
protected function getRecipientsEmails() { if (is_array($this->recipients)) { foreach ($this->recipients as $userId) { $email = \Veer\Models\User::where('id', '=', $userId)->pluck('email'); if (!empty($email)) { $this->emails[] = $email; } } } }