public static function email_user($data, $userID) { $time = Carbon::now('America/Denver'); $name = "Scavenger Update"; $applicationEmail = "*****@*****.**"; $adminEmail = "*****@*****.**"; $user = User::findOrFail($userID); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "To: {$user->first_name} {$user->last_name}" . "\r\n"; $headers .= "From: {$name} <{$applicationEmail}>" . "\r\n"; // The message $message = "<html><head><title>Scavenger</title></head><body>"; $message .= "<br><br><div>{$data}</div>"; $message .= "</body></html>"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, "\r\n"); // Send //$success = mail($user->email, "Scavenger Update", $message, $headers); //$success = mail($adminEmail, "Scavenger Update", $message, $headers); $success = false; if ($success) { echo "<h2>MAIL SENT.</h2>"; } else { echo "<h2>MAIL FAILED TO SEND.</h2>"; } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (Auth::user()->id == 1) { $socialMediaAccounts = SocialMediaAccount::orderBy('account_type', "DESC")->get(); } else { $socialMediaAccounts = SocialMediaAccount::where('user_id', Auth::user()->id)->get(); } $currentAccount = User::where('id', Auth::user()->id)->get()->first()->username; $bladeVariables = compact('socialMediaAccounts', 'currentAccount'); return view('accounts.index')->with($bladeVariables); }
/** * Run the database seeds. * * @return void */ public function run() { $socialMediaAccount = new SocialMediaAccount(); $socialMediaAccount->account_type = 'twitter'; $socialMediaAccount->screen_name = 'GraysonErhard'; $socialMediaAccount->account_password = '******'; $socialMediaAccount->consumer_key = '4nJh80KE5bVyuyY9WlT5rTYlN'; $socialMediaAccount->consumer_secret = 'dYvw5tYAc2xnoKw3wdHc13oIdq6i7kEt5ndaxfoA4d0kUgNPmw'; $socialMediaAccount->access_token = '1286744324-cE9hzxLNxEjCDxslk3i6yMeuKBIkhpwFyUaFNg5'; $socialMediaAccount->access_token_secret = 'FUYJ4ISw2KGA5slIsn0byOae6mOHih9eMu8FfkZjkoSR0'; $socialMediaAccount->auto_follow = '1'; $socialMediaAccount->auto_unfollow = '1'; $socialMediaAccount->auto_whitelist = '1'; $socialMediaAccount->user_id = '1'; $socialMediaAccount->save(); $user = new User(); $user->username = "******"; $user->password = bcrypt("password"); $user->email = "*****@*****.**"; $user->role = "0"; $user->first_name = "Grayson"; $user->last_name = "Erhard"; $user->save(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($id) { $currentAccount = User::where('id', Auth::user()->id)->get()->first()->username; if ($id != 'select' && 'search') { $socialMediaAccount = SocialMediaAccount::findOrFail($id); $modelAccounts = ModelAccount::where('social_media_account_id', $id)->orderBy('sort_order', 'ASC')->get(); $bladeVariables = compact('socialMediaAccount', 'modelAccounts', 'currentAccount'); return view('set-user.search')->with($bladeVariables); } else { if (Auth::user()->id == 1) { $socialMediaAccounts = SocialMediaAccount::where('account_type', 'twitter')->get(); } else { $socialMediaAccounts = SocialMediaAccount::where('user_id', Auth::user()->id)->get(); } $bladeVariables = compact('socialMediaAccounts', 'currentAccount'); return view('set-user.index')->with($bladeVariables); } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = User::create(['username' => $data['username'], 'email' => $data['email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'role' => $data['role'], 'password' => bcrypt($data['password'])]); return $user; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($user_id) { $user = User::where('id', $user_id); // dd($user); $user->take(1)->delete(); return redirect("/users"); }