コード例 #1
0
ファイル: vendor.php プロジェクト: HLitmus/WebApp
 /**
  * @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
0
ファイル: modelTest.php プロジェクト: hugoabonizio/torm
 /**
  * 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
0
ファイル: model.php プロジェクト: RHY3756547/FreeSO
 public static function fromCredentials($user, $passHash)
 {
     return Account::first('username='******' AND password=' . safeSQLString($passHash));
 }
コード例 #4
0
ファイル: ModelTest.php プロジェクト: gigorok/php-orm
 public function testHasOneRelation()
 {
     $this->assertEquals(Account::first(), User::first()->account());
 }
コード例 #5
0
ファイル: AccountTest.php プロジェクト: yeyande/CS499
 /**
  * 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
0
 public static function GetByName($accountName, $activatedOnly = false)
 {
     $account = Account::first(array('account_name' => $accountName, 'IsApproved' => $activatedOnly));
     return $account;
 }
コード例 #7
0
ファイル: modelTest.php プロジェクト: taq/torm
 /**
  * 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);
 }