当前位置: 首页>>代码示例>>PHP>>正文


PHP Account::where方法代码示例

本文整理汇总了PHP中app\models\Account::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::where方法的具体用法?PHP Account::where怎么用?PHP Account::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Account的用法示例。


在下文中一共展示了Account::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: retrieveByCredentials

 public function retrieveByCredentials(array $credentials)
 {
     if (static::PAMAuthenticate($credentials['username'], $credentials['password'])) {
         return Account::where('username', $credentials['username'])->get()->first();
     }
     return false;
 }
开发者ID:SYpanel,项目名称:SYpanel,代码行数:7,代码来源:PAMUserProvider.php

示例2: run

 /**
  *
  */
 public function run()
 {
     $this->faker = Faker::create();
     $users = User::all();
     $this->expenseMerchants = ['John Doe', 'Jane Doe', 'John Smith', 'Sally Woods', 'Fred'];
     $this->expenseMerchantsIndex = -1;
     foreach ($users as $user) {
         $this->accounts = Account::where('user_id', $user->id)->get();
         // Get budget ids for user
         $this->fixedBudgetIds = $user->fixedBudgets()->lists('id')->all();
         $this->flexBudgetIds = $user->flexBudgets()->lists('id')->all();
         $this->mixedBudgetIds = [$this->fixedBudgetIds[0], $this->flexBudgetIds[0]];
         $num = 1;
         if ($user->id === 2) {
             $num = 20;
         }
         // Create transactions without budgets
         $this->createIncomeTransactionsWithoutBudgets($user, $num);
         $this->createExpenseTransactionsWithoutBudgets($user, $num);
         $this->createTransferTransactions($user, $num);
         //Create transactions with budgets
         $this->createExpenseTransactionsWithBudgets($user, $num);
         $this->createIncomeTransactionsWithBudgets($user, $num);
     }
 }
开发者ID:JennySwift,项目名称:budget,代码行数:28,代码来源:TransactionSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('events')->insert([['id' => '1', 'eventName' => 'PartyNight', 'date' => '2016-01-01', 'startTime' => '14:00:00', 'endTime' => '15:00:00', 'location' => 'Beijing', 'description' => 'A test Event 1.', 'capacity' => 123, 'conferenceID' => 1], ['id' => '2', 'eventName' => 'Speech', 'date' => '2017-01-01', 'startTime' => '12:00:00', 'endTime' => '12:30:00', 'location' => 'Mumbai', 'description' => 'A test Event 2.', 'capacity' => 123, 'conferenceID' => 1]]);
     $role = RoleCreate::AllEventRoles(1);
     Account::where('email', 'root@localhost')->get()->first()->attachRole($role);
     $role = RoleCreate::AllEventRoles(2);
     Account::where('email', 'root@localhost')->get()->first()->attachRole($role);
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:13,代码来源:EventsTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $conferences = [['id' => 1, 'conferenceName' => 'Foo', 'dateStart' => '2016-01-01', 'dateEnd' => '2016-02-01', 'location' => 'Earth', 'description' => 'A test conference.', 'hasTransportation' => true, 'hasAccommodations' => false], ['id' => 2, 'conferenceName' => 'Bar', 'dateStart' => '2016-02-03', 'dateEnd' => '2016-02-05', 'location' => 'Earth', 'description' => 'A test conference number 2.', 'hasTransportation' => true, 'hasAccommodations' => true]];
     foreach ($conferences as $conf) {
         $c = Conference::create($conf);
         $role = RoleCreate::AllConferenceRoles($c->id);
         Account::where('email', 'root@localhost')->get()->first()->attachRole($role);
     }
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:14,代码来源:ConferenceTableSeeder.php

示例5: resetPassword

 public function resetPassword(Request $request)
 {
     if (!$request->has('email')) {
         return response()->json(['message' => 'no_email_given'], 400);
     }
     $account = Account::where('email', $request->input('email'))->get()->first();
     if (!isset($account)) {
         return response()->json(['message' => 'account_not_found'], 400);
     }
     $this->dispatch(new ResetPassword($account));
     return ["message" => "email_pending"];
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:12,代码来源:AuthenticationController.php

示例6: getCounts

 public function getCounts($userId)
 {
     $accounts = Account::where('referral_user_id', $userId)->get();
     $counts = ['free' => 0, 'pro' => 0, 'enterprise' => 0];
     foreach ($accounts as $account) {
         $counts['free']++;
         $plan = $account->getPlanDetails(false, false);
         if ($plan) {
             $counts['pro']++;
             if ($plan['plan'] == PLAN_ENTERPRISE) {
                 $counts['enterprise']++;
             }
         }
     }
     return $counts;
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:16,代码来源:ReferralRepository.php

示例7: 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, 'clients' => $clients, 'message' => $message];
     return View::make('reports.d3', $data);
 }
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:16,代码来源:ReportController.php

示例8: d3

 public function d3()
 {
     $message = '';
     $fileName = storage_path() . '/dataviz_sample.txt';
     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 (file_exists($fileName)) {
         $clients = file_get_contents($fileName);
         $message = trans('texts.sample_data');
     } else {
         $clients = '[]';
     }
     $data = ['clients' => $clients, 'message' => $message];
     return View::make('reports.d3', $data);
 }
开发者ID:n-a-m-e,项目名称:invoice-ninja,代码行数:17,代码来源:ReportController.php

示例9: register

 /**
  * Register a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function register(Request $request)
 {
     //Check if the request has account and password
     $validator = Validator::make($request->all(), ['account' => 'required|max:16', 'password' => 'required|max:20']);
     //If it is lack of account and password
     if ($validator->fails()) {
         return response()->json(['status' => 404, 'message' => 'input error', 'data' => null]);
     }
     //Check if the account is existed
     try {
         $exist = Account::where('account', '=', $request->input('account'))->firstOrFail();
     } catch (ModelNotFoundException $e) {
         $account = $request->input('account');
         $password = $request->input('password');
         $name = $request->input('name', 'default_user');
         $gender = $request->input('gender', 'unknown');
         $nationality = $request->input('nationality', 'France');
         $city = $request->input('city', 'Villejuif');
         $address = $request->input('address', '');
         //$hobby = $request->input('hobby','');
         $nickName = $request->input('nickName', '');
         $birthday = $request->input('birthday', '');
         //store it to the database
         $Account = new Account();
         $Account->account = $account;
         $Account->password = $password;
         $Account->name = $name;
         $Account->nickName = $nickName;
         $Account->gender = $gender;
         $Account->address = $address;
         $Account->nationality = $nationality;
         $Account->city = $city;
         //$Account->hobby = $hobby;
         $Account->birthday = $birthday;
         $Account->save();
         return response()->json(['status' => 0, 'message' => 'ok', 'data' => $Account->id]);
     }
     return response()->json(['status' => 403, 'message' => 'account existed', 'data' => null]);
 }
开发者ID:toto150,项目名称:eventPlaner,代码行数:45,代码来源:AccountController.php

示例10: run

 /**
  *
  */
 public function run()
 {
     $users = User::all();
     foreach ($users as $user) {
         foreach ($this->favourites as $favourite) {
             $newFavourite = new FavouriteTransaction(['name' => $favourite['name'], 'type' => $favourite['type'], 'description' => $favourite['description'], 'merchant' => $favourite['merchant'], 'total' => $favourite['total']]);
             $newFavourite->user()->associate($user);
             if ($favourite['type'] === 'transfer') {
                 $newFavourite->fromAccount()->associate(Account::where('user_id', $user->id)->where('name', $favourite['fromAccount'])->first());
                 $newFavourite->toAccount()->associate(Account::where('user_id', $user->id)->where('name', $favourite['toAccount'])->first());
             } else {
                 $newFavourite->account()->associate(Account::where('user_id', $user->id)->where('name', $favourite['account'])->first());
             }
             $newFavourite->save();
             $budgetIds = [];
             foreach ($favourite['budgets'] as $budgetName) {
                 $budgetIds[] = Budget::where('user_id', $user->id)->where('name', $budgetName)->pluck('id');
             }
             $newFavourite->budgets()->attach($budgetIds);
         }
     }
 }
开发者ID:JennySwift,项目名称:budget,代码行数:25,代码来源:FavouriteTransactionsSeeder.php

示例11: checkEmail

 public function checkEmail(Request $request)
 {
     $account = Account::where('email', '=', $request->only('email'))->first();
     if ($account === null) {
         return response()->json(['taken' => false]);
     } else {
         return response()->json(['taken' => true]);
     }
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:9,代码来源:RegistrationController.php

示例12: handlePaymentWebhook

 /**
  * @param $accountKey
  * @param $gatewayId
  * @return \Illuminate\Http\JsonResponse
  */
 public function handlePaymentWebhook($accountKey, $gatewayId)
 {
     $gatewayId = intval($gatewayId);
     $account = Account::where('accounts.account_key', '=', $accountKey)->first();
     if (!$account) {
         return response()->json(['message' => 'Unknown account'], 404);
     }
     $accountGateway = $account->getGatewayConfig(intval($gatewayId));
     if (!$accountGateway) {
         return response()->json(['message' => 'Unknown gateway'], 404);
     }
     $paymentDriver = $accountGateway->paymentDriver();
     try {
         $result = $paymentDriver->handleWebHook(Input::all());
         return response()->json(['message' => $result]);
     } catch (Exception $exception) {
         Utils::logError($exception->getMessage(), 'PHP');
         return response()->json(['message' => $exception->getMessage()], 500);
     }
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:25,代码来源:OnlinePaymentController.php

示例13: getCurrent

 /**
  * 获取当前选择的Account.
  *
  * @return Account
  */
 public function getCurrent()
 {
     return AccountModel::where('id', Session::get('account_id'))->first();
 }
开发者ID:GitNavTeam,项目名称:viease,代码行数:9,代码来源:Account.php

示例14: getByTag

 /**
  * 根据tag获取公众号.
  *
  * @param string $tag tag
  *
  * @return Model
  */
 public function getByTag($tag)
 {
     return $this->model->where('tag', $tag)->first();
 }
开发者ID:GitNavTeam,项目名称:viease,代码行数:11,代码来源:AccountRepository.php

示例15: approvedDependents

 public function approvedDependents($accountID)
 {
     if (!Entrust::can(PermissionNames::ApproveUserRegistration()) && Auth::user()->id != $accountID) {
         return response()->json(["message" => "no_user_approval_access"]);
     }
     $account = Account::where('id', '=', $accountID)->first();
     if ($account === null) {
         return response()->json(['message' => 'account_not_found']);
     } else {
         $dependents = User::where('accountID', '=', $account->id)->where('approved', '=', true)->get();
         return response()->json(['message' => 'returned_approved_dependents', 'dependents' => $dependents]);
     }
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:13,代码来源:UserController.php


注:本文中的app\models\Account::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。