本文整理汇总了PHP中Illuminate\Contracts\Auth\Guard::id方法的典型用法代码示例。如果您正苦于以下问题:PHP Guard::id方法的具体用法?PHP Guard::id怎么用?PHP Guard::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Auth\Guard
的用法示例。
在下文中一共展示了Guard::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect()->route('user.info', ['id' => $this->auth->id()]);
}
return $next($request);
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() && $request->route()->id == $this->auth->id()) {
return $next($request);
}
return redirect()->back();
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->user()->uncompleteProfile) {
return redirect()->route('user.edit', $this->auth->id())->with('message', 'Debe completar sus datos en el perfil');
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->query->has('ntf_read') && $this->auth->check()) {
$id = $request->query->get('ntf_read');
$id = hashids_decode($id);
NotificationTarget::where('notification_id', $id)->where('user_id', $this->auth->id())->update(['read' => true]);
}
return $next($request);
}
示例5: save
/**
* Save user Activity
*
* @param $action
* @param array $param
* @param array $data
* @return UserActivity
*/
public function save($action, array $param = [], array $data = null)
{
$activityData = ['action' => $action, 'param' => $param, 'data' => $data];
if (session('role_id') == '3' || session('role_id') == '4') {
$userId = session('admin_id');
} else {
$userId = $this->auth->id();
}
$activityData['user_id'] = $userId;
$activityData['organization_id'] = session('org_id');
return $this->userActivityRepo->save($activityData);
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$player = $this->router->getCurrentRoute()->getParameter('player');
$player->load('account');
if (!$this->auth->check() or !$player or $this->auth->id() !== $player->account->id()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
throw new DifferentAccountPlayerException();
}
}
return $next($request);
}
示例7: verify
/**
* Check credentials for oauth password grant
* @param string $username
* @param sting $password
* @return boolean|int
*/
public function verify($username, $password)
{
$credentials = compact('password');
if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
$credentials['email'] = $username;
} else {
$credentials['username'] = $username;
}
$credentials['active'] = 1;
if ($this->auth->once($credentials)) {
return $this->auth->id();
}
return false;
}
示例8: doCreateAlbum
public function doCreateAlbum(Guard $guard, Request $request)
{
if ($guard->guest()) {
throw new AppException(AppException::NEED_SIGN_IN);
}
$musics = $request->get('musics');
$coverImageId = $request->get('cover_image_id');
$title = $request->get('title');
$artist = $request->get('artist');
$year = $request->get('year');
$genre = $request->get('genre');
$album = new Album();
$album->title = $title;
$album->artist = $artist;
$album->year = $year;
$album->genre = $genre;
$album->coverImage()->associate($coverImageId);
$album->user()->associate($guard->id());
$album->save();
foreach ($musics as $musicId) {
/** @var Music $music */
$music = Music::where('id', $musicId)->first();
if (!$music) {
continue;
}
$album->musics()->attach($musicId);
if (!$music->coverImage) {
$music->coverImage()->associate($album->coverImage);
$music->save();
}
}
return $this->buildResponse(trans('api.album.create.success'), Tools::toArray($album));
}
示例9: handle
/**
* Handle the command.
*
* @param Guard $auth
*/
public function handle(Guard $auth)
{
if ($this->entry->created_at) {
$this->entry->updated_at = time();
$this->entry->updated_by = $auth->id();
}
if (!$this->entry->created_at) {
$this->entry->created_at = time();
$this->entry->created_by = $auth->id();
}
if (!$this->entry->sort_order) {
/* @var Builder $query */
$query = $this->entry->newQuery();
$this->entry->sort_order = $query->count('id') + 1;
}
}
示例10: getEdit
public function getEdit(Guard $auth)
{
$postulante = Postulante::where('user_id', $auth->id())->first();
$testimonio = Testimonio::where('postulante', $postulante->id)->first();
$id = $testimonio->id;
$editor = $testimonio->cuerpo;
return view('testimonio.edit', compact('editor', 'id'));
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:8,代码来源:TestimonioController.php
示例11: postStore
public function postStore(DeclaracionRequest $request, Guard $auth)
{
$declaracion = new Declaracion();
$declaracion->fill($request->all());
$declaracion->postulante = Postulante::where('user_id', $auth->id())->first()->id;
$declaracion->save();
return response()->json(['message' => "su declaración se ha guardado exitosamente."]);
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:8,代码来源:DeclaracionController.php
示例12: postStoreAndUpdate
public function postStoreAndUpdate(Request $request, Guard $auth)
{
$this->validate($request, ['numero' => 'required', 'tipo' => 'required']);
$postulante = Postulante::where('user_id', $auth->id())->first();
$documento = DocumentoIdentidad::firstOrNew(array('tipo' => $request->get('tipo'), 'postulante' => $postulante->id));
$documento->numero = $request->get('numero');
$documento->save();
return response()->json(['message' => 'Se almacenó los datos del documento de identidad correctamente.']);
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:9,代码来源:DocumentoIdentidadController.php
示例13: postStore
public function postStore(RepressentanteRequest $request, Guard $auth)
{
$postulante = Postulante::where('user_id', $auth->id())->first();
$representanteUach = new PreUResponsable();
$representanteUach->fill($request->all());
$representanteUach->postulante = $postulante->id;
$representanteUach->save();
return response()->json(['message' => 'se Guardó el representante Correctamente.']);
// dd('entre');
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:10,代码来源:RepresentanteUachController.php
示例14: store
/**
* Creates a new asset.
*
* @param AssetRequest $request
*
* @return bool
*/
public function store(AssetRequest $request)
{
$asset = $this->asset->newInstance();
$asset->user_id = $this->guard->id();
$asset->tag = $request->input('tag');
$asset->category_id = $request->input('category');
$asset->location_id = $request->input('location');
$asset->name = $request->input('name');
$asset->condition = $request->input('condition');
$asset->vendor = $request->input('vendor');
$asset->make = $request->input('make');
$asset->model = $request->input('model');
$asset->size = $request->input('size');
$asset->weight = $request->input('weight');
$asset->serial = $request->input('serial');
$asset->acquired_at = $request->formatDateWithTime($request->input('acquired_at'));
$asset->end_of_life = $request->formatDateWithTime($request->input('end_of_life'));
return $asset->save();
}
示例15: postStoreAndUpdate
public function postStoreAndUpdate(Guard $auth, Request $request)
{
$postulante = Postulante::where('user_id', $auth->id())->first();
$solicitudCurso = PreNuSolicitudCurso::firstOrNew(array('postulante' => $postulante->id));
$solicitudCurso->save();
$detalleSolicitud = new DetalleSolicitudCurso();
$detalleSolicitud->solicitud_curso = $solicitudCurso->id;
$detalleSolicitud->asignatura = $request->get('asignatura');
$detalleSolicitud->save();
return response()->json(['message' => 'La asignatura se ha adjuntado a la solicitud de cursos.']);
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:11,代码来源:SolicitudCursoController.php