public function showAll() { if (Auth::user()->roles_id == 3) { $users = User::whereRaw('roles_id = 4 and location = ' . Auth::user()->location)->paginate(20); } else { $users = User::where('roles_id', '4')->paginate(20); } return View::make('back.users', compact('users')); }
/** * Execute the console command. * * @return mixed */ public function fire() { $users = \credits\Entities\User::whereRaw('roles_id = 5 and hasCredit = 0 and user_state = 1')->get(); foreach ($users as $user) { $email = $user->email; Mail::send('emails.ESimpleAccept', ['msn' => 'prueba'], function ($m) use($email) { $m->to($email, 'Creditos Lilipink')->subject('Notificación Lilipink'); }); } Mail::send('emails.ESimpleAccept', ['msn' => 'prueba'], function ($m) { $m->to('*****@*****.**', 'Creditos Lilipink')->subject('Notificación Lilipink'); }); }
private function setData($identification) { $extracts = Extract::where("nit", $identification)->orderBy('id', 'DESC')->get(); if ($extracts) { $user = User::whereRaw("roles_id = 4 and identification_card = {$identification}")->first(); $minPay = ExcelDaily::where("cedula", $identification)->get(); $quota = CreditRequest::where('user_id', $user->id)->first(); $day = explode('-', date("y-m-d")); $q = $quota ? $quota->value : 300000; $this->data = ['user' => $user, 'day' => $day, 'extracts' => $extracts, 'quota' => intval($q), 'minPay' => $minPay, 'months' => $this->getMonths()]; return true; } return false; }
public function showRequest() { if (Auth::user()->roles_id == 4) { return Redirect::to('/'); } $locations = Location::all(); if (Auth::user()->roles_id == 3) { $showRequest = DB::table('creditRequest')->join('users', 'users.id', '=', 'creditRequest.user_id')->whereRaw("`creditRequest`.`created_at` >= '2015-11-15 00:00:00' and `creditRequest`.`state`='' and users.location = " . Auth::user()->location)->get(); } else { $showRequest = DB::table('creditRequest')->join('users', 'users.id', '=', 'creditRequest.user_id')->whereRaw("`creditRequest`.`created_at` >= '2015-11-15 00:00:00' and `creditRequest`.`state`=''")->get(); } foreach ($showRequest as $user) { if (isset($user->CreditRequest)) { $date = $this->date($user->CreditRequest["created_at"]); if ($date) { $user->CreditRequest["priority"] = "1"; } } } $simpleEnterpricings = User::whereRaw('roles_id = 5 and hasCredit = 0 and user_state is null')->get(); return View::make('front.request', compact('showRequest', 'locations', 'simpleEnterpricings')); }
public function enterpricingSimpleList() { if (Auth::user()->roles_id == 4) { return Redirect::to('/'); } if (Auth::user()->roles_id == 3) { $users = User::whereRaw('users.roles_id = 5 and users.hasCredit = 0 and users.location = ' . Auth::user()->location . " and user_state < 2")->orderBy('user_state')->paginate(20); } else { $users = User::whereRaw('users.roles_id = 5 and users.hasCredit = 0 and user_state < 2')->orderBy('user_state')->paginate(20); } return View::make('back.enterpricingList', compact('users')); }