本文整理汇总了PHP中UserController::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::getUser方法的具体用法?PHP UserController::getUser怎么用?PHP UserController::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::getUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUsersChat
public static function getUsersChat($code)
{
$user = UserController::getUser(Auth::user());
$sectionCodes = null;
if ($user instanceof Teacher) {
$sectionCodes = SectionCode::where('teacher_id', new MongoId($user->_id))->where('status', true)->where('code', $code)->first();
} else {
if ($user instanceof Student) {
$sectionCodes = SectionCode::whereIn('students_id', array(new MongoId($user->_id)))->where('status', true)->where('code', $code)->first();
}
}
return $sectionCodes;
}
示例2: resetPassword
/**
* Reset password for the student
*
* @return View
*/
public function resetPassword()
{
$user = User::first(['_id' => trim(Input::get('_id'))]);
$user->password = Hash::make(Input::get('password'));
$user->save();
$info = UserController::getUser($user);
$data = array('name' => strtoupper($info->name));
Mail::send('emails.confirm-reset-password', $data, function ($message) {
$message->to(strtolower(trim(Input::get('email'))))->subject(Lang::get('forget-password.reset_succes'));
});
$user = BlockedUser::where('user', $user->user)->first();
if (isset($user->_id)) {
$user->delete();
if (Session::has($user->user)) {
Session::forget($user->user);
}
}
return Redirect::to('/')->with('message', Lang::get('register_student.password_changed'));
}
示例3: UserController
if (isset($_POST['action'])) {
// instantiate classes to call functions from
$UserController = new UserController();
$ProjectController = new ProjectController();
$PageController = new PageController();
// handle which function to call
switch ($_POST['action']) {
// User Methods
case "createUser":
$UserController->createUser();
break;
case "deleteUser":
$UserController->deleteUser();
break;
case "getUser":
$UserController->getUser();
break;
case "checkLoggedIn":
$UserController->checkLoggedIn();
break;
case "isAdmin":
$UserController->isAdmin();
break;
case "login":
$UserController->login();
break;
case "logout":
$UserController->logout();
break;
// Project Methods
// Project Methods
示例4:
$stats = MessageController::getStats();
?>
<ul class="nav navbar-top-links navbar-right user-menu" id="user-menu">
<li class="dropdown">
<a href="#" class="settings dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope" style="color: #0097A7;"></i>
@if($stats['unread'] > 0)
<span id="unread" class="badge bg-pink">{{$stats['unread']}}</span>
@endif
</a>
<ul class="dropdown-menu inbox dropdown-user">
@foreach($unreadMessages as $index => $message)
<li class="popups" id="{{$index+1}}">
<a>
<?php
$user = UserController::getUser(User::first($message->from));
?>
@if($user->profile_image === null)
<img src="images/140x140.png" class="avatar" alt="avatar"></td>
@else
<img src="{{Lang::get('show_image').'?src='.storage_path().$user->profile_image}}" class="avatar"/>
@endif
<input type="hidden" id="id{{$index+1}}" value="{{$message->_id}}">
<div>
<span class="username">{{$user->name}}</span>
<span class="time pull-right">
<i class="fa fa-clock-o"></i>
{{MessageController::getDate($message->sent_date)}}
</span>
</div>
示例5:
<tr>
<td>{{$key + 1}}</td>
<td>{{$assignment->description}}</td>
<td>{{MessageController::getDate($assignment->date_assigned)}}</td>
<td>{{MessageController::getDate($assignment->deadline, false)}}</td>
<td>
<?php
$user = User::first($assignment->assigned_to);
$user = UserController::getUser($user);
?>
{{$user->name.' '.$user->last_name}}
</td>
<td>
<?php
$user = User::first($assignment->assigned_by);
$user = UserController::getUser($user);
?>
{{$user->name.' '.$user->last_name}}
</td>
<td>{{$assignment->score}}</td>
<td>{{$assignment->rated}}</td>
</tr>
@endforeach
</tbody>
</table>
@else
<p>{{Lang::get('teacher_master.activity')}}</p>
@endif
</div>
</div>
</div>
示例6: function
if (Auth::guest()) {
return Request::ajax() ? Response::make('Unauthorized', 401) : Redirect::guest('/');
}
});
Route::filter('university', function () {
if (!UserController::getUser(Auth::user()) instanceof University) {
return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
}
});
Route::filter('student', function () {
if (!UserController::getUser(Auth::user()) instanceof Student) {
return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
}
});
Route::filter('teacher', function () {
if (!UserController::getUser(Auth::user()) instanceof Teacher) {
return Request::ajax() ? Response::make('Unauthorized', 401) : View::make('error.403');
}
});
Route::filter('auth.basic', function () {
return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
示例7: searchOrigin
/**
* Checks whether the recipient isn't the same user
*
* @param $id MongoId
* @return Boolean
*/
public static function searchOrigin($id)
{
$message = UserController::getUser(Auth::user())->messages()->find($id);
if ($message->from !== Auth::id()) {
return true;
} else {
return null;
}
}