当前位置: 首页>>代码示例>>PHP>>正文


PHP Guard::id方法代码示例

本文整理汇总了PHP中Illuminate\Auth\Guard::id方法的典型用法代码示例。如果您正苦于以下问题:PHP Guard::id方法的具体用法?PHP Guard::id怎么用?PHP Guard::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Auth\Guard的用法示例。


在下文中一共展示了Guard::id方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created snippet in storage.
  *
  * @param SnippetsRequest $request
  * @return Response
  */
 public function store(SnippetsRequest $request)
 {
     $this->auth->basic('username');
     $data = ['title' => $request->input('title') ?: null, 'user_id' => $this->auth->user() ? $this->auth->id() : null, 'password' => $request->input('password') ?: null, 'mode' => $request->input('mode') ?: 'markdown'];
     $snippet = $this->dispatchFrom(StoreNewSnippetCommand::class, $request, $data);
     return 'http://drk.sh/s/' . $snippet->slug->slug . PHP_EOL;
 }
开发者ID:elvios,项目名称:darkshare,代码行数:13,代码来源:SnippetsController.php

示例2: 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:jacksun101,项目名称:streams-platform,代码行数:21,代码来源:SetMetaInformation.php

示例3: submit

 public function submit($id, Request $request, Guard $auth)
 {
     $this->validate($request, ['comment' => 'required|max:250', 'link' => 'url']);
     $comment = new TicketComments($request->only('comment', 'link'));
     $comment->user_id = $auth->id();
     $ticket = Ticket::findOrFail($id);
     $ticket->comments()->save($comment);
     session()->flash('success', 'Tu comentario fue guardado exitosamente');
     return redirect()->back();
 }
开发者ID:Burris19,项目名称:First-Aplication-Laravel-5.1,代码行数:10,代码来源:CommentsController.php

示例4: nuevo

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function nuevo($id, Request $request, Guard $auth)
 {
     $this->validate($request, ['comentario' => 'required|max:250', 'link' => 'url']);
     $comentario = new TicketComentario($request->all());
     $comentario->user_id = $auth->id();
     $ticket = Ticket::findOrFail($id);
     $ticket->comentarios()->save($comentario);
     session()->flash('success', 'Comentario guardado correctamente');
     return redirect()->back();
     //$comentario = new TicketComentario($request->only(['comentario', 'link']));
 }
开发者ID:alzort,项目名称:ByteCode-es-Ticket,代码行数:16,代码来源:ComentarioController.php

示例5: getImportJobByUser

 /**
  * Get Import Job by User
  *
  * @return array
  */
 public function getImportJobByUser()
 {
     $dirs = $this->filesystem->directories($this->getFilePath());
     $user_key = [];
     if (empty($dirs)) {
         return $user_key;
     }
     foreach ($dirs as $dir) {
         $key = last(explode('/', $dir));
         $json = $this->getJsonData($key, false);
         if (empty($json)) {
             continue;
         }
         $contracts = $json->contracts;
         if (isset($contracts[0]->user_id) && $contracts[0]->user_id == $this->auth->id()) {
             $user_key[] = ['step' => $json->step, 'key' => $key, 'is_completed' => $this->isImportCompleted($key), 'file' => $this->getOriginalFileName($key)];
         }
     }
     return $user_key;
 }
开发者ID:sadhakbj,项目名称:resourcecontracts.org,代码行数:25,代码来源:ImportService.php

示例6: set

 /**
  * Set a preference value.
  *
  * @param $key
  * @param $value
  * @return $this
  */
 public function set($key, $value)
 {
     $preference = $this->model->where('user_id', $this->auth->id())->where('key', $key)->first();
     if (!$preference) {
         $preference = $this->model->newInstance();
         $preference->user_id = $this->auth->id();
         $preference->key = $key;
     }
     if (!($field = config(str_replace('::', '::preferences/preferences.', $key)))) {
         $field = config(str_replace('::', '::preferences.', $key));
     }
     if (is_string($field)) {
         $field = ['type' => $field];
     }
     $type = app(array_get($field, 'type'));
     $modifier = $type->getModifier();
     if ($modifier instanceof FieldTypeModifier) {
         $value = $modifier->modify($value);
     }
     $preference->value = $value;
     $preference->save();
     return $this;
 }
开发者ID:AkibaTech,项目名称:preferences-module,代码行数:30,代码来源:PreferenceRepository.php

示例7: id

 /**
  * Get the ID for the currently authenticated user.
  *
  * @return int|null 
  * @static 
  */
 public static function id()
 {
     return \Illuminate\Auth\Guard::id();
 }
开发者ID:satriashp,项目名称:tour,代码行数:10,代码来源:_ide_helper.php

示例8: handle

 /**
  * Handle the form fields.
  *
  * @param Guard           $auth
  * @param PostFormBuilder $builder
  */
 public function handle(Guard $auth, PostFormBuilder $builder)
 {
     $builder->setFields(['*', 'author' => ['config' => ['default_value' => $auth->id()]], 'publish_at' => ['config' => ['default_value' => 'now']]]);
 }
开发者ID:ramcda,项目名称:posts-module,代码行数:10,代码来源:PostFormFields.php

示例9: save

 /**
  * @param        $activityLog
  * @param string $user_id
  * @return bool
  */
 public function save($activityLog, $user_id = null)
 {
     $activityLog['user_id'] = is_null($user_id) ? $this->auth->id() : $user_id;
     return $this->activityLog->create($activityLog) ? true : false;
 }
开发者ID:sadhakbj,项目名称:resourcecontracts.org,代码行数:10,代码来源:ActivityLogRepository.php


注:本文中的Illuminate\Auth\Guard::id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。