本文整理汇总了PHP中Member::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::find方法的具体用法?PHP Member::find怎么用?PHP Member::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _manage_platoon
public static function _manage_platoon($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$unassignedMembers = Platoon::unassignedMembers($platoonId, true);
$squads = Squad::findByPlatoonId($platoonId);
$memberCount = count((array) Platoon::members($platoonId));
$js = 'manage';
Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
} else {
// insufficient access
Flight::redirect('404/', 404);
}
} else {
// nonexistent platoon
Flight::redirect('404/', 404);
}
}
示例2: overview
public function overview()
{
$members = Member::find('all', ['order' => 'username']);
$this->setViewData('members', $members);
$schedules = Schedule::find('all', ['conditions' => ['date >= UNIX_TIMESTAMP()'], 'order' => 'date']);
$this->setViewData('schedules', $schedules);
}
示例3: loanAccountNumber
public static function loanAccountNumber($loanaccount)
{
$member = Member::find($loanaccount->member->id);
$count = count($member->loanaccounts);
$count = $count + 1;
//$count = DB::table('loanproducts')->where('member_id', '=', $loanaccount->member->id)->count();
$loanno = $loanaccount->loanproduct->short_name . "-" . $loanaccount->member->membership_no . "-" . $count;
return $loanno;
}
示例4: _doUsersOnline
public static function _doUsersOnline()
{
if (isset($_SESSION['loggedIn'])) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
Flight::render('user/online_list', compact('user', 'member'));
} else {
Flight::render('user/online_list');
}
}
示例5: createAccount
public static function createAccount($id)
{
$member = Member::find($id);
$share = new Share();
$acc = 'SH-' . $member->membership_no;
$shareaccount = new Shareaccount();
$shareaccount->member()->associate($member);
$shareaccount->account_number = $acc;
$shareaccount->opening_date = date('Y-m-d');
$shareaccount->save();
}
示例6: _doDivisionThreadCheck
public static function _doDivisionThreadCheck()
{
if (!empty($_POST['player'])) {
$player = trim($_POST['player']);
$member = Member::find(intval($_SESSION['memberid']));
$gameThreads = DivisionThread::find_all($member->game_id);
$js = 'check_threads';
Flight::render('recruiting/thread_check', compact('js', 'gameThreads', 'player'));
} else {
echo "<span class='text-muted'>A valid player was not provided!</span>";
}
}
示例7: _authenticate
public static function _authenticate()
{
if (User::isLoggedIn()) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
Flight::render('layouts/auth', [], 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
} else {
Flight::render('layouts/auth', [], 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
}
}
示例8: store
/**
* Store a newly created shareaccount in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Shareaccount::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$member = Member::find(Input::get('member_id'));
$acc = 'SH-' . $member_no;
$shareaccount = new Shareaccount();
$shareaccount->member()->associate($member);
$shareaccount->account_number = $acc;
$shareaccount->opening_date = date();
$shareaccount->save();
return Redirect::route('shareaccounts.index');
}
示例9: actionLogin
public function actionLogin()
{
$model = new Member();
$email = $_REQUEST['email'];
$passwd = md5($_REQUEST['passwd']);
$arr = $model->find()->where(['email' => $email])->asArray()->one();
if ($arr) {
if ($arr['password'] == $passwd) {
$res['code'] = '10200';
$res['mess'] = 'success';
$res['stat'] = '';
exit(json_encode($res));
}
}
print_r($arr);
die;
}
示例10: _doBattlelogIdUpdate
function _doBattlelogIdUpdate()
{
$members = array();
$battlelog_names = objectToArray(Member::find(array('status_id' => 1, 'battlelog_name !%' => 0, 'battlelog_id' => 0)));
$countNames = count($battlelog_names);
echo "Fetched battlelog names. ({$countNames})<br /><br />";
foreach ($battlelog_names as $row) {
$battlelog_id = Member::getBattlelogId($row['battlelog_name']);
if (!$battlelog_id['error']) {
$sql = "UPDATE member SET battlelog_id = {$battlelog_id['id']} WHERE battlelog_name = '{$row['battlelog_name']}'";
Flight::aod()->sql($sql)->one();
echo "Added ID {$battlelog_id['id']} to {$row['battlelog_name']}<br />";
} else {
echo "ERROR: {$row['battlelog_name']} - {$battlelog_id['message']}<br />";
}
}
echo "done syncing battlelog ids.";
}
示例11: _retentionNumbers
public static function _retentionNumbers()
{
$user = User::find(intval($_SESSION['userid']));
if ($user->role >= 3 || User::isDev()) {
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$recruited = Report::recruitedLast30days($member->game_id);
$removed = Report::removedLast30days($member->game_id);
$monthlyBreakdown = Report::recruitingWeekly($member->game_id);
$byTheMonth = Report::recruitingByTheMonth($member->game_id);
$js = 'report';
Flight::render('reports/retention', compact('recruited', 'removed', 'js', 'monthlyBreakdown', 'byTheMonth'), 'content');
Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions));
} else {
Flight::redirect('/404', 404);
}
}
示例12: getUserProfile
/**
* This function shows user profile
*/
public function getUserProfile()
{
if (Session::get('admin') == 'admin') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Admin::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
if (Session::get('employee') == 'employee') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Employee::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
if (Session::get('member') == 'member') {
$user = User::where('username', '=', Session::get('username'))->get()->first();
$userProfile = Member::find($user->details_id);
$userProfile->DOB = DateFormat::show($userProfile->DOB);
return View::make('user.profile')->with('userProfile', $userProfile);
}
}
示例13: postSignIn
public function postSignIn()
{
// check validation
$validator = Validator::make(Input::all(), array('username' => 'required', 'password' => 'required'));
// if validation is failed it's redirected
// to sign in page with validation errors
if ($validator->fails()) {
return Redirect::route('signin-get')->withErrors($validator)->withInput();
} else {
$remember = Input::has('remember') ? true : false;
$auth = Auth::attempt(array('username' => Input::get('username'), 'password' => trim(Input::get('password')), 'active' => 1), $remember);
if ($auth) {
$user = User::where('username', '=', Input::get('username'))->get()->first();
// Holding all important data
// from database to session
// variable
Session::put('username', $user->username);
Session::put('user_level', $user->user_level);
Session::put('user_id', $user->id);
Session::put('wc_msg', 1);
if ($user->user_level === 'admin') {
Session::put('admin', 'admin');
Session::put('employee_id', Employee::find($user->details_id)->id);
return Redirect::intended('/admin');
} elseif ($user->user_level === 'employee') {
Session::put('employee', 'employee');
Session::put('employee_id', Employee::find($user->details_id)->id);
return Redirect::intended('/employee');
} elseif ($user->user_level === 'member') {
Session::put('member', 'member');
Session::put('member_id', Member::find($user->details_id)->id);
return Redirect::intended('/member');
}
} else {
return View::make('userAuthentication.signin')->with('invalid', 'Invalid Username/Password.');
}
}
}
示例14: importSavings
public static function importSavings($member, $date, $savingaccount, $amount)
{
$member = Member::find($member[0]->id);
$savingaccount = Savingaccount::find($savingaccount[0]->id);
//check if account and member exists
$savingtransaction = new Savingtransaction();
$savingtransaction->date = $date;
$savingtransaction->savingaccount()->associate($savingaccount);
$savingtransaction->amount = $amount;
$savingtransaction->type = 'credit';
$savingtransaction->description = 'savings deposit';
$savingtransaction->transacted_by = $member->fullname;
$savingtransaction->save();
foreach ($savingaccount->savingproduct->savingpostings as $posting) {
if ($posting->transaction == 'deposit') {
$debit_account = $posting->debit_account;
$credit_account = $posting->credit_account;
}
}
$data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => $date, 'amount' => $amount, 'initiated_by' => 'system', 'description' => 'cash deposit');
$journal = new Journal();
$journal->journal_entry($data);
Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'Savings imported', 'Savings', $amount);
}
示例15: postAction
public function postAction()
{
try {
$id = Arr::get($_POST, 'id', null);
$password = Arr::get($_POST, 'password', false);
$email = Arr::get($_POST, 'email', '');
$name = Arr::get($_POST, 'name', '');
$birthday = Arr::get($_POST, 'birthday', '');
$phone = Arr::get($_POST, 'phone', '');
$address = Arr::get($_POST, 'address', '');
if ($id === null) {
throw new Exception('request error.');
}
$m = Member::find($id);
if ($m == null) {
throw new Exception('not found user');
}
if (!$password) {
$password = trim($password);
if (!empty($password)) {
$m->password = Hash::make($password);
}
}
$m->email = $email;
$m->name = $name;
$m->birthday = $birthday;
$m->phone = $phone;
$m->address = $address;
if (!$m->save()) {
throw new Exception('store user error');
}
return Redirect::route('admin.member.list');
} catch (Exception $e) {
return Redirect::route('admin.member.list', array('message' => $e->getMessage()));
}
}