本文整理汇总了PHP中Account::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::where方法的具体用法?PHP Account::where怎么用?PHP Account::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_temporal
public function create_temporal()
{
$input = Input::All();
$username = $input["username"];
$domain = Config::get("constants.TEMPORAL_DOMAIN");
$email = $username . $domain;
$password = $input["password"];
$passwordVerify = $input["passwordVerify"];
$success = false;
if (Account::where("email", "=", $email)->count() >= 1) {
$response = "El nombre de usuario ya esta registrado.";
} else {
if (strcmp($password, $passwordVerify) == 0) {
try {
$account = new Account(array("email" => $email, "password" => Hash::make($password), "role_id" => Config::get("constants.ACCOUNT_TYPE.TEMPORAL"), "activated" => true));
$account->save();
$success = true;
$response = "El usuario " . $email . " se ha creado correctamente.";
} catch (Exception $ex) {
$response = "No se ha podido crear el usuario";
}
} else {
$response = "Las contraseñas no coinciden.";
}
}
return Response::json(array("success" => $success, "response" => $response));
}
示例2: getAccount
public function getAccount($userId)
{
if (!$this->account) {
$this->account = Account::where('user_id', '=', $userId)->first();
}
return $this->account;
}
示例3: historyAllFromDb
public function historyAllFromDb()
{
// youlove = 161
$ids = [1527, 2163, 1448, 14523, 1301, 14533];
//,1527,2163,1926,1247,3,6,3082];
$a = array();
$lives = Helpers::SK_liveHistoryAll();
$json = array();
$data = [];
$tmp = [];
$i = 0;
foreach ($lives as $obj) {
//$user = Account::find($id);
$username = $obj['owner'];
//echo $username . "<br/>";
$user = Account::where('username', $username)->get()->first();
//$url = 'http://server-a.vdomax.com:8080/record/?user='.$username;
//$api_response = cURL::get($url);
//$response = $api_response->toArray();
//$response = $response['body'];
//$json["sample_url"] = "http://server-a.vdomax.com:8080/record/youlove-310115_23:59:46.flv";
//$history = json_decode($response,true);
//if($history != null) {
//foreach ($history as $obj) {
if ($user) {
$tmp['user_id'] = $user->id;
$tmp['username'] = $username;
$tmp['avatar'] = "http://www.vdomax.com/" . $user->avatar;
$tmp['last_thumb'] = "https://www.vdomax.com/clips/rtmp/" . $username . ".png";
$tmp['url'] = "http://server-a.vdomax.com:8080/record/" . $obj['file_name'] . ".flv";
$tmp['transcode'] = "http://server-a.vdomax.com:8080/record/transcode/" . $obj['file_name'] . ".flv-480x272.mp4";
$tmp['thumb'] = "http://server-a.vdomax.com:8080/record/" . $obj['file_name'] . ".flv.png";
$tmp['view'] = $obj['view'];
$tmp['love'] = $obj['love'];
$tmp['duration']['hours'] = rand(0, 1) . "";
$tmp['duration']['minutes'] = rand(10, 59) . "";
$tmp['duration']['seconds'] = rand(10, 59) . "";
$tmp['date'] = "1430227302";
}
/*
"hours": "00",
"minutes": "33",
"seconds": "24.08"
*/
//$tmp['duration'] = $obj['duration'];
//$tmp['date'] = $obj['date'];
$data[] = $tmp;
//}
//}
}
/*
usort($data, function($a, $b) { //Sort the array using a user defined function
return $a['date'] > $b['date'] ? -1 : 1; //Compare the scores
});
*/
$json['count'] = count($data);
$json['history'] = $data;
//$a = Helpers::SK_liveHistoryAll();
return Response::json($json);
}
示例4: update
public function update()
{
$account_type = Input::get('account-type');
$email = Input::get('email');
$name = Input::get('name');
$phone = Input::get('phone');
$former_password = Input::get('former-password');
$new_password = Input::get('new-password');
$sess_email = Session::get('pb_user_email');
$fake_sess_email = "udemesamuel256@ymail.com";
// check if the former password matches the one in the database...
$account = Account::where('email', '=', $sess_email)->first();
$user_password = $account->password;
$existing_phone_number_two = $account->phone_number_two;
$existing_phone_privacy = $account->phone_privacy;
if ($former_password == $user_password) {
$account->name = $name;
$account->account_type = $account_type;
$account->phone_number = $phone;
$account->phone_number_two = $existing_phone_number_two;
$account->phone_privacy = $existing_phone_privacy;
$account->email = $email;
$account->password = $new_password;
$account->save();
// for security purpose mail the user... do that in later version...
return Redirect::to('/settings')->with(array('welcome_back' => 'Your account has been succesfully updated.'));
} else {
return Redirect::to('/settings')->with(array('message' => 'Your password does not match with the one on our record.'));
}
}
示例5: update_referal_signup
function update_referal_signup($user_id)
{
try {
if ($user_id != '-') {
$user = User::find($user_id);
if (isset($user->id)) {
$month = date('m');
$year = date('Y');
$referral = Referral::where('user_id', '=', $user_id)->where(DB::raw('month(created_at)'), '=', $month)->where(DB::raw('year(created_at)'), '=', $year)->first();
if (!isset($referral->id)) {
$referral = new Referral();
$referral->user_id = $user_id;
}
$referral->total_signup = $referral->total_signup + 1;
if ($referral->proposal_gained <= 30) {
$proposal = 5;
$referral->proposal_gained = $referral->proposal_gained + $proposal;
$account = Account::where('user_id', '=', $user_id)->first();
$account->monthly_proposal_limit = $account->monthly_proposal_limit + $proposal;
$account->save();
}
$referral->save();
}
}
} catch (Exception $e) {
}
}
示例6: home
public function home()
{
$this->generateAccounts();
$account = Account::where('used', '!=', 1)->first()->toArray();
$arr = $this->getAvailableOffers($account['email']);
$data['email'] = $arr['email'];
return View::make('home', compact('data', 'arr'));
}
示例7: destroyMenu
/**
* 删除旧菜单.
*
* @param int $accountId 公众号id
*/
public function destroyMenu($accountId)
{
$menus = $this->all($accountId);
array_map(function ($menu) {
if ($menu['type'] == 'click') {
$this->eventRepository->distoryByEventKey($menu['key']);
}
}, $menus);
$this->model->where('account_id', $accountId)->delete();
}
示例8: savePassword
public function savePassword()
{
$auth = Auth::attempt(array('username' => Session::get('username'), 'password' => Input::get('old-password')));
if ($auth) {
$account = Account::where('username', '=', Session::get('username'))->first();
$account->password = Hash::make(Input::get('new-password'));
$account->save();
return Response::json(array('valid' => TRUE, 'message' => 'The password is successfully changed.'));
} else {
return Response::json(array('valid' => FALSE, 'message' => 'The old password is incorrect.'));
}
}
示例9: authenticate
public static function authenticate($username, $password)
{
// Grab the user based on username
$user = self::where('username', '=', $username)->firstOrFail();
// Grab the salt based on userId
$account = Account::where('userId', '=', $user->userId)->firstOrFail();
$hashedPassword = md5($account->salt . $password);
if ($hashedPassword === $user->password) {
return $user;
} else {
return null;
}
}
示例10: d3
public function d3()
{
$message = '';
if (Auth::user()->account->isPro()) {
$account = Account::where('id', '=', Auth::user()->account->id)->with(['clients.invoices.invoice_items', 'clients.contacts'])->first();
$account = $account->hideFieldsForViz();
$clients = $account->clients->toJson();
} elseif (isset($_ENV['DATA_VIZ_SAMPLE'])) {
$clients = $_ENV['DATA_VIZ_SAMPLE'];
$message = trans('texts.sample_data');
} else {
$clients = '[]';
}
$data = ['feature' => ACCOUNT_DATA_VISUALIZATIONS, 'clientes' => $clients, 'message' => $message];
return View::make('reports.d3', $data);
}
示例11: action_sendEmails
public function action_sendEmails()
{
$accounts = Account::where('wishlistEmail', '=', '1')->get();
foreach ($accounts as $account) {
$matches = array();
$tags = $account->wishlistitems()->get();
$listings = array();
$tempListings = array();
foreach ($tags as $tag) {
$tagListings;
$strings = explode(' ', $tag->item);
if (sizeof($strings) == 1) {
$tagListings = Listing::where('title', 'LIKE', "%{$tag->item}%")->or_where("description", 'LIKE', "%{$tag->item}%")->get();
} else {
$string = array_pop($strings);
$query = "\tSELECT *\n\t\t\t\t\t\t\t\tFROM listings\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t(title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
while (!empty($strings)) {
$string = array_pop($strings);
$query .= " AND (title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
}
$tagListings = DB::query($query);
}
foreach ($strings as $string) {
}
foreach ($tagListings as $listing) {
$listing->location = Location::find($listing->location_id);
$listing->category = Categorie::find($listing->category_id);
}
array_push($tempListings, $tagListings);
}
foreach ($tempListings as $key => $tagListings) {
foreach ($tagListings as $listing) {
$listings[$listing->id] = $listing;
}
}
var_dump(sizeof($listings));
if (sizeof($listings) > 0) {
$email = $account->email;
$subject = 'REMARKET: Matches found on your wishlist!';
$message = "There have recently been matches found which match the tags in your wishlist. \n\n" . "Go to market319.tk/ and login to view your wishlist.\n" . "\n\n Happy buying, \n The REMARKET team";
$header = "from: REMARKET <no-reply@market.tk>";
$sent = mail($email, $subject, $message, $header);
}
}
}
示例12: index
function index($name)
{
$a = new Account();
if ($name != "") {
$c = new Campaign();
$c->where('nickname', $name)->get();
if ($c->id > 0) {
$data['campaign_id'] = $c->id;
$data['name'] = $c->name;
$data['description'] = $c->description;
$data['photo'] = $c->photo;
$data['countryid'] = $c->countryid;
$data['categoryid'] = $c->categoryid;
$data['isInfo'] = $c->isInfo;
$data['title'] = $c->name;
/*
* get comments for the campaign
*/
$com = new Comment();
$com->where('campaign_id', $c->id)->get();
//$comments = new ArrayObject();
$commentsStr = "[";
$flag = 0;
foreach ($com->all as $comment) {
$usr = new Account();
$usr->where('id', $comment->user_id)->get();
$preCom = "<img src = '" . base_url() . "/images/profile/" . $usr->photo . "' align='left'><i>says </i>";
if ($flag) {
$commentsStr = $commentsStr . ",";
}
$flag = 1;
$commentsStr = $commentsStr . "\"" . $preCom . $comment->comment . "\"";
//$data['comments'][] = $comment->comment;
//$data['comments_uid'][] = $comment->user_id;
}
$commentsStr = $commentsStr . "]";
$data['commentsStr'] = $commentsStr;
$data['commentsNum'] = $com->count();
}
}
$data['a'] = $a;
$_SESSION['url'] = site_url('destination/index/' . $name);
$this->load->view('destination', $data);
}
示例13: login
/**
* login: user
* password: 123
*/
public function login()
{
$data = array();
if (!empty($_POST)) {
$profile = new Account(NULL);
$profile->where('login', param('login'))->where('password', sha1(param('password')))->get();
// Loop through to see all related users
foreach ($profile as $p) {
echo 'SN: ' . $p->service_name . '<br />';
echo 'Nick: ' . $p->user->nick . '<br />';
echo 'Email: ' . $p->user->email . '<br />';
echo '<hr />';
}
} else {
if (is_ajax()) {
} else {
$this->template->render_to('content', $this->view . 'login', $data)->show();
}
}
}
示例14: showOutstandingCharges
public function showOutstandingCharges()
{
$user = Confide::user();
$accounts = null;
if (Request::isMethod('GET')) {
// send user to view search for charges outstanding
return View::make('home/billing/show-outstanding-charges', compact('user', 'accounts'));
} elseif (Request::isMethod('POST')) {
// update balances
// Search for account by name
if (Input::has('list_all')) {
$accounts = Account::where('balance', '>', 0)->get();
} elseif (Input::has('first_name') || Input::has('last_name')) {
$patient_id = User::where('first_name', '=', trim(Input::get('first_name')))->where('last_name', '=', trim(Input::get('last_name')))->lists('id');
if (sizeof($patient_id) > 0) {
$accounts = Account::where('patient_id', '=', $patient_id[0])->where('balance', '>', 0)->get();
}
} elseif (Input::has('email')) {
$patient_id = User::where('email', '=', trim(Input::get('email')))->lists('id');
if (sizeof($patient_id) > 0) {
$accounts = Account::where('patient_id', '=', $patient_id[0])->where('balance', '>', 0)->get();
}
}
// Make accounts null if it is empty
$accounts = sizeof($accounts) != 0 ? $accounts : null;
if (!is_null($accounts)) {
foreach ($accounts as $account) {
$account->user = User::find($account->patient_id);
}
}
//search for charges outstanding and will return all patients with a balance > 0
// they can either search an individual account or all patients with balances > 0
/*
example
Last name First name Amount due
Orduno Raul $20.00
Z Jay $25,0000
*/
return View::make('home/billing/show-outstanding-charges', compact('user', 'accounts'));
}
}
示例15: account_create
public function account_create()
{
$redo = Session::get('redo');
$vote_id = Session::get('vote_id');
if ($redo == 1) {
Account::where('vote_id', '=', $vote_id)->delete();
}
$vote_data = Session::get('vote_data');
$vote_amount = $vote_data[1];
// $table->increments('id');
// $table->string('username');
// $table->integer('vote_id')->unsigned();
for ($x = 0; $x <= $vote_amount - 1; $x++) {
$str_rand = $this->GeraHash(6);
$zero_str_len = strlen($vote_amount) - strlen($x);
$zero_str = '';
for ($y = 1; $y <= $zero_str_len; $y++) {
$zero_str .= '0';
}
$index_no = $zero_str . $x;
$Caracteres = 'ABCDEFGHJKLMPQRSTUVXWYZ23456789';
$index_str = '';
for ($y = 0; $y < strlen($index_no); $y++) {
$index_ary[$y] = intval(substr($index_no, $y, 1));
$index_ary_insert[$y] = substr($Caracteres, $index_ary[$y] + 7, 1);
$index_str .= $index_ary_insert[$y];
}
//echo $index_str."**";
$str_rand = substr($str_rand, 0, 2) . $index_str . substr($str_rand, 3, 5);
$username_ary[$x] = $str_rand;
}
for ($x = 0; $x <= $vote_amount - 1; $x++) {
$account = new Account();
$account->username = $username_ary[$x];
$account->vote_id = $vote_data[0];
$account->save();
}
return Redirect::route('vote.insert-second', array('vote_id' => $vote_id));
}