本文整理汇总了PHP中Account::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::first方法的具体用法?PHP Account::first怎么用?PHP Account::first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::first方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile
/**
* @before _secure, _vendor, _admin
*/
public function profile()
{
$this->seo(array("title" => "Vendor Profile", "view" => $this->getLayoutView()));
$view = $this->getActionView();
$action = RequestMethods::post("action", "");
$account = Account::first(array("organization_id = ?" => $this->member->organization_id));
$org = $this->organization;
switch ($action) {
case 'tin':
$org->tin = RequestMethods::post("tin");
$org->tin_file = $this->_upload("tin_file");
$org->save();
$view->set("message", "Saved Successfully");
break;
case 'pan':
$org->pan = RequestMethods::post("pan");
$org->pan_file = $this->_upload("pan_file");
$org->save();
$view->set("message", "Saved Successfully");
break;
case 'lac':
$org->lac = $this->_upload("lac");
$org->save();
$view->set("message", "Saved Successfully");
break;
case 'termandcon':
$org->terms = $this->_upload("terms");
$org->save();
$view->set("message", "Saved Successfully");
break;
case 'authcerti':
$org->terms = $this->_upload("certi");
$org->save();
$view->set("message", "Saved Successfully");
break;
case 'user':
$user = User::first(array("id = ?" => $this->user->id));
$user->name = RequestMethods::post("name");
$user->phone = RequestMethods::post("phone");
$user->save();
$view->set("user", $user);
$view->set("message", "Saved Successfully");
break;
case 'account':
if (!$account) {
$account = new Account(array("user_id" => $this->user->id, "organization_id" => $this->organization->id, "name" => RequestMethods::post("name"), "bank" => RequestMethods::post("bank"), "number" => RequestMethods::post("number"), "ifsc" => RequestMethods::post("ifsc", ""), "instamojo" => RequestMethods::post("instamojo", "")));
$account->save();
$view->set("message", "Saved Successfully");
}
break;
}
$view->set("account", $account);
}
示例2: testCantUpdatePKAttributes
/**
* Test can't update primary key
*
* @return null
*/
public function testCantUpdatePKAttributes()
{
$account = TORM\Factory::create("account");
$this->assertTrue($account->save());
$account = Account::first();
$old_id = $account->id;
$new_id = 999;
$new_num = "54321";
$this->assertTrue($account->updateAttributes(array("id" => $new_id, "number" => $new_num)));
$account = Account::find($old_id);
$this->assertNotNull($account);
$this->assertEquals($new_num, $account->number);
$this->assertNull(Account::find($new_id));
}
示例3: fromCredentials
public static function fromCredentials($user, $passHash)
{
return Account::first('username=' . safeSQLString($user) . ' AND password=' . safeSQLString($passHash));
}
示例4: testHasOneRelation
public function testHasOneRelation()
{
$this->assertEquals(Account::first(), User::first()->account());
}
示例5: testAccountCreateCredit
/**
* Tests that credit account may be created.
*
* @return void
*/
public function testAccountCreateCredit()
{
$params = array('customer_id' => $this->user->id, 'balance' => 1000.32, 'type' => 'credit');
$response = $this->call('POST', '/account', $params);
$account = Account::first();
$this->cleanUp();
$this->assertResponseStatus('201');
$this->assertEquals('credit', $account->type->name);
}
示例6: GetByName
public static function GetByName($accountName, $activatedOnly = false)
{
$account = Account::first(array('account_name' => $accountName, 'IsApproved' => $activatedOnly));
return $account;
}
示例7: testHasOneRelation
/**
* Test has one relation
*
* @return null
*/
public function testHasOneRelation()
{
$account = Account::first();
$user = User::first();
$acct = $user->account;
$this->assertNotNull($acct);
$this->assertEquals("Account", get_class($acct));
$this->assertEquals($account->account_number, $acct->account_number);
}