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


PHP Auth函数代码示例

本文整理汇总了PHP中Auth函数的典型用法代码示例。如果您正苦于以下问题:PHP Auth函数的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: updateTime

 public function updateTime($id, $requestData)
 {
     $task = Tasks::findOrFail($id);
     $input = array_replace($requestData->all(), ['fk_task_id' => "{$task->id}"]);
     TaskTime::create($input);
     $activityinput = array_merge(['text' => Auth()->user()->name . ' Inserted a new time for this task', 'user_id' => Auth()->id(), 'type' => 'task', 'type_id' => $id]);
     Activity::create($activityinput);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:8,代码来源:TaskRepository.php

示例2: postReview

 /**
  * Store a newly review to user
  *
  * @param ReviewRequest $request
  * @return Response
  */
 public function postReview($username, ReviewRequest $request)
 {
     $input = array_add($request->all(), 'author_id', Auth()->user()->id);
     $user = $this->userRepository->findByUsername($username);
     $review = new Review();
     $review->storeReviewForUser($user->id, $input['author_id'], $input['comment'], $input['rating']);
     return Redirect()->route('profile_reviews', $user->username);
 }
开发者ID:alons182,项目名称:guanacastevende,代码行数:14,代码来源:UsersController.php

示例3: index

 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     //$articles = Article::latest('published_at')->where('published_at', '<=', Carbon::now())->get();
     $articles = Auth()->user();
     /*      $article = $articles->first();
             $article->title = 'Updated title';
             $article->save();*/
     return view('blog.blogPage');
 }
开发者ID:gaofan1234,项目名称:BlogProject.dev,代码行数:12,代码来源:BlogPagesController.php

示例4: updateAssign

 public function updateAssign($id, $requestData)
 {
     $lead = Leads::findOrFail($id);
     $input = $requestData->get('fk_user_id_assign');
     $input = array_replace($requestData->all());
     $lead->fill($input)->save();
     $insertedName = $lead->assignee->name;
     $activityinput = array_merge(['text' => auth()->user()->name . ' assigned lead to ' . $insertedName, 'user_id' => Auth()->id(), 'type' => 'lead', 'type_id' => $id]);
     Activity::create($activityinput);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:10,代码来源:LeadRepository.php

示例5: AuthComment

function AuthComment($type)
{
    $getsession = Auth($type);
    if (!empty($getsession)) {
        return $getsession;
    } else {
        $key = 'comment_author_' . $type;
        $getcookie = isset($_COOKIE[COOKIE_PRE . $key]) ? $_COOKIE[COOKIE_PRE . $key] : '';
        return $getcookie;
    }
}
开发者ID:leunico,项目名称:aliceBlog,代码行数:11,代码来源:Function.php

示例6: handle

 /**
  * Handle the event.
  *
  * @param  ClientAction  $event
  * @return void
  */
 public function handle(ClientAction $event)
 {
     $client = $event->getClient();
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.client.created', ['company' => $client->company_name, 'assignee' => $client->AssignedUser->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Client::class, 'type_id' => $client->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:19,代码来源:ClientActionLog.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $lead = Leads::findOrFail($request->id);
     $settings = Settings::all();
     $isAdmin = Auth()->user()->hasRole('administrator');
     $settingscomplete = $settings[0]['lead_assign_allowed'];
     if ($isAdmin) {
         return $next($request);
     }
     if ($settingscomplete == 1 && Auth()->user()->id == $lead->fk_user_id_assign) {
         Session()->flash('flash_message_warning', 'Not allowed to create lead');
         return redirect()->back();
     }
     return $next($request);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:22,代码来源:IsLeadAssigned.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $task = Tasks::findOrFail($request->id);
     $settings = Settings::all();
     $isAdmin = Auth()->user()->hasRole('administrator');
     $settingscomplete = $settings[0]['task_assign_allowed'];
     if ($isAdmin) {
         return $next($request);
     }
     if ($settingscomplete == 1 && Auth()->user()->id != $task->fk_user_id_assign) {
         Session()->flash('flash_message_warning', 'Only assigned user are allowed to do this');
         return redirect()->back();
     }
     return $next($request);
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:22,代码来源:IsTaskAssigned.php

示例9: Authenticate

function Authenticate($client)
{
    if (isset($_SESSION['service_token'])) {
        $token = $_SESSION['service_token'];
        if ($client->getAuth()->isAccessTokenExpired()) {
            $token = Auth($client);
            $_SESSION['service_token'] = $token;
        } else {
            $client->setAccessToken($_SESSION['service_token']);
        }
    } else {
        $token = Auth($client);
        $_SESSION['service_token'] = $token;
    }
    return $token;
}
开发者ID:Steadroy,项目名称:Dashboard,代码行数:16,代码来源:analytics.php

示例10: store

 public function store()
 {
     $validator = Validator::make(Input::all(), ['nameaccount' => 'required|min:6', 'numberaccount' => 'required|min:27|max:34']);
     if ($validator->passes()) {
         //            $wallet = UserDeposit::where('user_id','=',Auth()->user()->getAuthIdentifier())->first();
         $nameAccount = Input::get('nameaccount');
         $numberAccount = Input::get('numberaccount');
         if ($wallet = BitcoinAccount::create(array('user_id' => Auth()->user()->getAuthIdentifier(), 'name' => $nameAccount, 'number_account' => $numberAccount, 'status' => 'pending', 'balance_in' => 0, 'balance_out' => 0))) {
             //si se guardo la informacion ahoa si muevo el archivo
             return redirect()->route('wallets.index');
         } else {
             return redirect()->route('wallets.index')->withErrors($validator);
         }
     } else {
         return redirect()->route('wallets.index')->withErrors($validator);
     }
 }
开发者ID:jda1586,项目名称:MCS-DHI,代码行数:17,代码来源:WalletsController.php

示例11: create

 public function create()
 {
     //获取所有分类
     $getCate = Cate::all();
     $cates = array();
     foreach ($getCate as $k => $v) {
         $cates[$v->id] = $v->name;
     }
     $teams = array();
     $teams[0] = '非团队博文';
     $teamMembers = TeamMember::where('user_id', \Auth()->user()->id)->get();
     foreach ($teamMembers as $teamMember) {
         $team = Team::findOrFail($teamMember->team_id);
         $teams[$team->id] = $team->title;
     }
     return view('member.articles.create', compact('cates', 'teams'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:17,代码来源:ArticlesController.php

示例12: ArticlesForSites

 public static function ArticlesForSites()
 {
     $args = json_decode(UrlVar('json', '{}'));
     $sites = array();
     if (is_array($args->sites)) {
         foreach ($args->sites as $id) {
             $site = MapController::LoadMapItem((int) $id);
             if (Auth('read', $site, 'mapitem')) {
                 $sites[] = array_merge(array('id' => $site->getId(), 'name' => $site->getName()), self::ItemMetadata($site));
             } else {
                 echo json_encode(array('success' => false, 'message' => 'invalid id:' . $id . ' in list, or no access'), JSON_PRETTY_PRINT);
                 return;
             }
         }
     }
     echo json_encode(array('sites' => $sites, 'success' => true), JSON_PRETTY_PRINT);
 }
开发者ID:nickolanack,项目名称:geolive-bcmt-customexport,代码行数:17,代码来源:AjaxRequest.php

示例13: toArray

 /**
  * Get the array representation of the notification.
  *
  * @param  mixed  $notifiable
  * @return array
  */
 public function toArray($notifiable)
 {
     switch ($this->action) {
         case 'created':
             $text = lang::get('misc.notifications.task.created', ['title' => $this->task->title, 'creator' => $this->task->taskCreator->name]);
             break;
         case 'updated_status':
             $text = lang::get('misc.notifications.task.status', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         case 'updated_time':
             $text = lang::get('misc.notifications.task.time', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = lang::get('misc.notifications.task.assign', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         default:
             break;
     }
     return ['assigned_user' => $notifiable->id, 'created_user' => $this->task->fk_user_id_created, 'message' => $text, 'type' => Tasks::class, 'type_id' => $this->task->id, 'url' => url('tasks/' . $this->task->id), 'action' => $this->action];
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:26,代码来源:TaskActionNotification.php

示例14: __construct

 function __construct()
 {
     $pagine_repo = new PagineRepo();
     $contenuti_footer = $pagine_repo->getContentForPage('index');
     view()->share('contenuti_footer', $contenuti_footer);
     view()->share('user', \Auth()->user());
     if (\Auth::user()) {
         view()->share('user_role', array_pluck(\Auth::user()->roles()->get(), 'name')[0]);
     }
     view()->share('menu', MenuItems::all()->keyBy('slug'));
     if (Session::has('locale')) {
         $locale = Session::get('locale');
     } else {
         $locale = 'it';
     }
     \App::setLocale($locale);
     Session::put('locale', $locale);
     // dd(\App::getLocale($locale));
     view()->share('text', Config::get('traduzioni.' . $locale));
     Session::put('currentPage', '');
 }
开发者ID:sidis405,项目名称:ibi,代码行数:21,代码来源:Controller.php

示例15: handle

 /**
  * Handle the event.
  *
  * @param  TaskAction  $event
  * @return void
  */
 public function handle(TaskAction $event)
 {
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.task.created', ['title' => $event->getTask()->title, 'creator' => $event->getTask()->taskCreator->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         case 'updated_status':
             $text = Lang::get('misc.log.task.status', ['username' => Auth()->user()->name]);
             break;
         case 'updated_time':
             $text = Lang::get('misc.log.task.time', ['username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = Lang::get('misc.log.task.assign', ['username' => Auth()->user()->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Tasks::class, 'type_id' => $event->getTask()->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
开发者ID:bottelet,项目名称:flarepoint,代码行数:27,代码来源:TaskActionLog.php


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