本文整理汇总了PHP中Account::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::find方法的具体用法?PHP Account::find怎么用?PHP Account::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionModify
function actionModify()
{
$id = (int) $this->_context->get('id');
$rs = Account::find('user_id = ?', $id)->getOne();
if (!$rs->id()) {
return $this->msg($tip = '参数错误', url('manage::account'));
}
$form = Form_Common::createForm('', 'manage/profile');
if ($this->_context->isPOST() && $form->validate($_POST)) {
$post = $form->values();
$user_mail = $post['user_mail'];
$user_pass = $post['user_pass'];
$is_locked = $post['is_locked'] ? '1' : '0';
#dump($post);
if ($user_pass) {
$user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
$rs->user_pass;
}
$rs->user_mail = $user_mail;
$rs->is_locked = $is_locked;
$rs->save();
return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
}
$form->import($rs->toArray());
$form->element('user_pass')->value = '';
$form->element('is_locked')->checked = $rs->is_locked;
#dump($form->element('is_locked'));
$this->_view['form'] = $form;
$this->_view['rs'] = $rs;
$order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
$this->_view['order'] = $order;
$this->_view['_UDI'] = 'manage::account/index';
}
示例2: get_account
function get_account(){
if($this->user_id){
return Account::find($this->user_id);
} else {
return new Account(array('username' => 'GUEST', 'email'=>'guest@rising-gods.de'),true);
}
}
示例3: action_delete
public function action_delete($id)
{
if (Session::has('id')) {
$account = Account::find(Session::get('id'));
$location = Location::find($id);
$owner = Account::find($location->account_id);
if ($account->id == $owner->id) {
$listings = Listing::where_location_id($location->id);
// foreach($listings as $listing)
// {
// $images = Image::where_listing_id($listing->id);
// foreach($images as $image)
// {
// $image->delete();
// }
// $listing->delete();
// }
$location->delete();
return Redirect::to('/account/myLocations/');
} else {
return Redirect::to('/');
}
} else {
return Redirect::to('/');
}
}
示例4: createPayment
private function createPayment($invitation, $ref, $payerId = null)
{
$invoice = $invitation->invoice;
$accountGateway = $invoice->client->account->account_gateways[0];
if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) {
$account = Account::find($invoice->client->public_id);
$account->pro_plan_paid = date_create()->format('Y-m-d');
$account->save();
}
if ($invoice->is_quote) {
$invoice = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id);
}
$payment = Payment::createNew($invitation);
$payment->invitation_id = $invitation->id;
$payment->account_gateway_id = $accountGateway->id;
$payment->invoice_id = $invoice->id;
$payment->amount = $invoice->amount;
$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('invoice.paid', $payment);
return $payment;
}
示例5: create
function create($params){
if(isset($params['partner']) && !empty($params['partner'])){
$partner_name_or_id = $params['partner'];
if(is_numeric($partner_name_or_id)){
$partner = Account::find($partner_name_or_id);
} else {
$partner = Account::find()->where(array('username' => $partner_name_or_id))->first();
}
if(isset($params['temp'])){
$params['until'] = mktime(
$params['hours_select'],
$params['minute_select'],
0,
$params['month_select'],
$params['day_select'],
$params['year_select']
);
}
if($partner){
$params['partner_id'] = $partner->id;
if(AccountPartner::create($params, $accpartner)){
$this->render_ajax('success', 'Partner created');
Event::trigger(Event::TYPE_ACCOUNT_PARTNER_ADD, User::$current, $partner);
} else {
$this->render_ajax('error', 'Creation failed with ' . $accpartner->errors[0]);
}
} else {
$this->render_ajax('error', 'Partner-Account not found!');
}
} else {
$this->render_ajax('error', 'No Partner-ID or -Name!');
}
}
示例6: __construct
public function __construct()
{
// Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
Asset::add('bootstrap', 'css/bootstrap.min.css');
Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
Asset::add('common', 'css/common.css');
// Asset::add('style', 'css/style.css');
Asset::add('fontawsome', 'css/fontawesome.css');
Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
Asset::add('jquery', 'js/jquery-1.9.1.js');
Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
Asset::add('bootstrap-js', 'js/bootstrap.js');
Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
// $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
// foreach($files as $file)
// {
// Asset::add($file, substr($file, 7));
// }
if (Session::has('id') && Auth::check()) {
$account = Account::find(Session::get('id'));
if ($account->admin == 1) {
Session::put('admin', '1');
} else {
Session::put('admin', '0');
}
if ($account->blocked == 1) {
Session::put('alert', "Your account has been banned. Please contact the admin for more details");
Session::forget('id');
Auth::logout();
} else {
}
}
}
示例7: update
public function update()
{
$param = Input::all();
$emp_id = Employee::where('ssn', '=', $param['ssn'])->pluck('id');
$user = Account::find($param['id']);
$res = $user->edit(array('username' => $param['username'], 'password' => $param['password'], 'emp' => $emp_id, 'role' => $param['role']));
return Response::json(array('valid' => $res));
}
示例8: action_delete
public function action_delete()
{
if (Input::has('tag_id') && Auth::check() && Session::has('id')) {
$account = Account::find(Session::get('id'));
$wishlistitem = WishlistItem::find(Input::get('tag_id'));
$wishlistitem->delete();
}
}
示例9: _before_execute
protected function _before_execute()
{
parent::_before_execute();
$this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
if (!$this->_user->id()) {
return $this->msg('请先登陆', url('default::default/signin'));
}
}
示例10: testFindSingleAccount
/**
* Tests that a single account may be located by id.
*
* @return void
*/
public function testFindSingleAccount()
{
$accounts = $this->createAccounts(3);
$response = $this->call('GET', "/account/{$accounts[1]->id}");
$expectedResponse = Account::find($accounts[1]->id)->toJson();
$this->cleanUp();
$this->assertEquals($expectedResponse, $response->getContent());
}
示例11: _before_execute
protected function _before_execute()
{
parent::_before_execute();
$this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
if (!in_array($this->_user->user_mail, Q::ini('appini/managers'))) {
return $this->msg('请先登陆', url('default::default/signin'));
}
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
if (Auth::user()->is_admin) {
$branches = Account::find(Auth::user()->account_id)->branches;
return View::make('sucursales.index')->with('sucursales', $branches);
}
return Redirect::to('/inicio');
}
示例13: dashboard
public function dashboard()
{
$sucursales = Branch::where('account_id', Auth::user()->account_id)->get();
$usuarios = Account::find(Auth::user()->account_id)->users;
$clientes = Account::find(Auth::user()->account_id)->clients;
$productos = Account::find(Auth::user()->account_id)->products;
$informacionCuenta = array('sucursales' => sizeof($sucursales), 'usuarios' => sizeof($usuarios), 'clientes' => sizeof($clientes), 'productos' => sizeof($productos));
// return Response::json($informacionCuenta);
return View::make('cuentas.dashboard')->with('cuenta', $informacionCuenta);
}
示例14: index
function index($params){
/*if(isset($params['id']) && $params['id'] == ''){
$this->render_error(404);
return;
}*/
$from = time();
$to = time();
if(!empty($params['bannedby']) && !is_numeric($params['bannedby'])){
$bannedby = Account::find()->where(array('username' => $params['bannedby']))->first();
if(is_object($bannedby))
$params['bannedby'] = $bannedby->id;
}
$bans = AccountBan::find()->where($params)->order('bandate DESC');
if(isset($params['page'])) $bans->page($params['page']);
if(empty($params['render_type']))
$params['render_type'] = 'html';
if(isset($params['filter_time']) && $params['filter_time'] == '1'){
$from = mktime(
$params['from_hours_select'],
$params['from_minute_select'],
0,
$params['from_month_select'],
$params['from_day_select'],
$params['from_year_select']
);
$to = mktime(
$params['to_hours_select'],
$params['to_minute_select'],
0,
$params['to_month_select'],
$params['to_day_select'],
$params['to_year_select']
);
$bans->where(array("bandate >= :from AND bandate <= :to", 'from' => $from, 'to' => $to));
}
$data = array(
'from' => $from,
'to' => $to,
'bans' => $bans->all(),
'bans_count' => $bans->count(),
);
if(isset($params['partial'])){
$this->render_partial('shared/bans', $data);
} else {
$this->render($data, $params['render_type']);
}
}
示例15: 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');
}