當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Guard::id方法代碼示例

本文整理匯總了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);
 }
開發者ID:Colls,項目名稱:meetings.laravel,代碼行數:14,代碼來源:RedirectIfAuthenticated.php

示例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();
 }
開發者ID:Colls,項目名稱:meetings.laravel,代碼行數:14,代碼來源:OwnerCheck.php

示例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);
 }
開發者ID:sotoplatero,項目名稱:lacallemonte,代碼行數:14,代碼來源:CheckPerfilMiddleware.php

示例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);
 }
開發者ID:vegax87,項目名稱:Strimoid,代碼行數:17,代碼來源:NotificationMarkRead.php

示例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);
 }
開發者ID:younginnovations,項目名稱:aidstream,代碼行數:20,代碼來源:ActivityManager.php

示例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);
 }
開發者ID:apolune,項目名稱:account,代碼行數:20,代碼來源:AccountCharacter.php

示例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;
 }
開發者ID:ruysu,項目名稱:laravel-core,代碼行數:20,代碼來源:OAuthPasswordGrantVerifier.php

示例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));
 }
開發者ID:lialosiu,項目名稱:amaoto-core,代碼行數:33,代碼來源:AlbumController.php

示例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;
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:21,代碼來源:SetMetaInformation.php

示例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();
 }
開發者ID:stevebauman,項目名稱:maintenance,代碼行數:26,代碼來源:AssetProcessor.php

示例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


注:本文中的Illuminate\Contracts\Auth\Guard::id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。