本文整理汇总了PHP中app\models\Account::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::find方法的具体用法?PHP Account::find怎么用?PHP Account::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Account
的用法示例。
在下文中一共展示了Account::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
public function fire()
{
$this->info(date('Y-m-d') . ' ChargeRenewalInvoices...');
$ninjaAccount = $this->accountRepo->getNinjaAccount();
$invoices = Invoice::whereAccountId($ninjaAccount->id)->whereDueDate(date('Y-m-d'))->where('balance', '>', 0)->with('client')->orderBy('id')->get();
$this->info(count($invoices) . ' invoices found');
foreach ($invoices as $invoice) {
// check if account has switched to free since the invoice was created
$account = Account::find($invoice->client->public_id);
if (!$account) {
continue;
}
$company = $account->company;
if (!$company->plan || $company->plan == PLAN_FREE) {
continue;
}
try {
$this->info("Charging invoice {$invoice->invoice_number}");
$this->paymentService->autoBillInvoice($invoice);
} catch (Exception $exception) {
$this->info('Error: ' . $exception->getMessage());
}
}
$this->info('Done');
}
示例2: validateCredentials
public function validateCredentials(UserContract $user, array $credentials)
{
$profile = $user instanceof Account ? $user : Account::find($user->getAuthIdentifier());
if ($profile && $profile->id == $user->getAuthIdentifier()) {
return static::PAMAuthenticate($profile->username, $credentials['password']);
}
return false;
}
示例3: demo
public function demo()
{
$demoAccountId = Utils::getDemoAccountId();
if (!$demoAccountId) {
return Redirect::to('/');
}
$account = Account::find($demoAccountId);
$user = $account->users()->first();
Auth::login($user, true);
return Redirect::to('invoices/create');
}
示例4: initAmounts
/**
For each account create an item. If previous balance sheet exists and has value - set it as default, otherwise - set to zero
*/
public function initAmounts()
{
$accounts = Account::find()->orderBy('order_code')->all();
$prevBalance = $this->getPreviouBalance();
for ($i = 0; $i < count($accounts); $i++) {
$amount = new BalanceAmount();
$amount->account_id = $accounts[$i]->id;
$amount->balance_sheet_id = $this->id;
$amount->amount = $prevBalance ? $prevBalance->balanceAmounts[$i]->amount : 0;
$amount->save();
}
}
示例5: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Account::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['account_id' => $this->account_id, 'person_id' => $this->person_id, 'remain_time' => $this->remain_time]);
return $dataProvider;
}
示例6: beforeValidate
public function beforeValidate()
{
if (parent::beforeValidate()) {
// ...custom code here...
if ($this->order_num == null) {
$this->order_num = Account::find()->where(['balance_item_id' => $this->balance_item_id])->max('order_num') + 1;
}
$this->order_code = $this->balanceItem->order_code . "." . $this->order_num;
return true;
} else {
return false;
}
}
示例7: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Account::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
$query->andFilterWhere(['like', 'account_number', $this->account_number])->andFilterWhere(['like', 'account_name', $this->account_name])->andFilterWhere(['like', 'saving_type', $this->saving_type])->andFilterWhere(['like', 'bank_name', $this->bank_name])->andFilterWhere(['like', 'brance', $this->brance]);
return $dataProvider;
}
示例8: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Account::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
// if (!$this->validate()) {
// // uncomment the following line if you do not want to return any records when validation fails
// //$query->where('0=1');
// return $dataProvider;
// }
$query->andFilterWhere(['account_id' => $this->account_id, 'date_added' => $this->date_added, 'date_updated' => $this->date_updated]);
$query->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'email_address', $this->email_address])->andFilterWhere(['like', 'added_ip', $this->added_ip])->andFilterWhere(['like', 'updated_ip', $this->updated_ip])->andFilterWhere(['like', 'password', $this->password]);
return $dataProvider;
}
示例9: store
/**
* POST /api/favouriteTransactions
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$favourite = new FavouriteTransaction($request->only(['name', 'type', 'description', 'merchant', 'total']));
$favourite->user()->associate(Auth::user());
$favourite->account()->associate(Account::find($request->get('account_id')));
$favourite->fromAccount()->associate(Account::find($request->get('from_account_id')));
$favourite->toAccount()->associate(Account::find($request->get('to_account_id')));
$favourite->save();
foreach ($request->get('budget_ids') as $id) {
$favourite->budgets()->attach($id);
}
$favourite = $this->transform($this->createItem($favourite, new FavouriteTransactionTransformer()))['data'];
return response($favourite, Response::HTTP_CREATED);
}
示例10: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Account::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere(['id' => $this->id]);
$query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'card_number', $this->card_number]);
return $dataProvider;
}
示例11: actionIndex
public function actionIndex()
{
$account = new \app\models\Account();
if (!empty($_POST)) {
$account = \app\models\Account::find()->where('username = :username AND password = :password', [':username' => $_POST['Account']['username'], ':password' => $_POST['Account']['password']])->one();
if (!empty($account)) {
$session = new \yii\web\Session();
$session->open();
$session['account_id'] = $account->id;
$session['account_name'] = $account->name;
return $this->redirect(['home']);
} else {
$account = new \app\models\Account();
$account->username = $_POST['Account']['username'];
$account->password = $_POST['Account']['password'];
}
}
return $this->render('//Backend/Index', ['account' => $account]);
}
示例12: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$force = $this->option('force');
$account = $this->argument('account');
$accounts = null;
if ($account) {
$accounts = Account::find($account)->get();
} else {
$accounts = Account::all();
}
$latestInvoice = $this->invoice->latest()->first();
$invoiceYear = Carbon::parse($latestInvoice->created_at)->year;
if (Carbon::now()->year > $invoiceYear || $force) {
$accounts->transform(function ($a) {
/** @var Account $a */
$a->invoice_number_counter = 1;
$a->update();
});
$this->info('The counter has been resetted successfully for ' . $accounts->count() . ' account(s).');
}
}
示例13: actionLog
public function actionLog()
{
$user = new Account();
$model = new LogForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if (isset($_POST['login'])) {
$user = Account::find()->where(['nickname' => $model->username])->one();
if ($user && $model->username == $user->nickname && $model->password == $user->password) {
if ($user->admin === 0) {
//Yii::$app->runAction('site/user', $user->userID);
return $this->redirect(array('site/user', 'id' => $user->userID));
} else {
if ($user->admin === 1) {
return $this->redirect(array('site/admin', 'id' => $user->userID));
//Yii::$app->runAction('site/admin', $user->userID);
}
}
} else {
return $this->render('fail');
}
}
}
return $this->render('login', ['model' => $model]);
}
示例14: date
use app\models\Account;
use app\models\Customer;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model app\models\Collection */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="collection-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'account_id')->dropDownList(ArrayHelper::map(Account::find()->all(), 'id', 'name'), ['prompt' => Yii::t('app', 'Select Account')]);
?>
<div class="form-group field-collection-time">
<label class="control-label" for="collection-time"><?php
echo Yii::t('app', 'Time');
?>
</label>
<?php
echo DatePicker::widget(['id' => 'collection-time', 'name' => 'Collection[time]', 'value' => $model->time ? $model->time : date('Y-m-d', strtotime('today')), 'options' => ['placeholder' => Yii::t('app', 'Select Time')], 'pluginOptions' => ['format' => 'yyyy-m-dd', 'todayHighLight' => true]]);
?>
</div>
<?php
echo $form->field($model, 'money')->textInput(['maxlength' => true]);
?>
示例15: createPayment
private function createPayment($invitation, $ref, $payerId = null)
{
$invoice = $invitation->invoice;
$accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'));
if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) {
$account = Account::find($invoice->client->public_id);
if ($account->pro_plan_paid && $account->pro_plan_paid != '0000-00-00') {
$date = DateTime::createFromFormat('Y-m-d', $account->pro_plan_paid);
$account->pro_plan_paid = $date->modify('+1 year')->format('Y-m-d');
} else {
$account->pro_plan_paid = date_create()->format('Y-m-d');
}
$account->save();
}
$payment = Payment::createNew($invitation);
$payment->invitation_id = $invitation->id;
$payment->account_gateway_id = $accountGateway->id;
$payment->invoice_id = $invoice->id;
$payment->amount = $invoice->getRequestedAmount();
$payment->client_id = $invoice->client_id;
$payment->contact_id = $invitation->contact_id;
$payment->transaction_reference = $ref;
$payment->payment_date = date_create()->format('Y-m-d');
if ($payerId) {
$payment->payer_id = $payerId;
}
$payment->save();
Event::fire(new InvoicePaid($payment));
return $payment;
}