當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。