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


PHP Controllers\Auth类代码示例

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


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

示例1: logout

 public function logout()
 {
     Auth::logout();
     // logout user
     return Redirect::to('admin/login');
     //redirect back to login
 }
开发者ID:devchd,项目名称:metronic,代码行数:7,代码来源:LoginController.php

示例2: index

 public function index()
 {
     $questions = Question::all();
     $tpl['user'] = \Auth::user();
     $tpl['questions'] = $questions;
     return view('home', $tpl);
 }
开发者ID:bhasunjaya,项目名称:askpeople,代码行数:7,代码来源:HomeController.php

示例3: postStore

 public function postStore(UsersRequest $request = null, $id = "")
 {
     $input = $request->except('save_continue', 'password_confirmation');
     $result = '';
     if (\Input::hasFile('photo')) {
         $photo = (new \ImageUpload($input))->upload();
     }
     if ($id == "") {
         $input['photo'] = isset($photo) ? $photo : "";
         $input['active'] = $input['active'];
         $input['group_id'] = $input['group_id'];
         $input['created_by'] = \Auth::user()->username;
         $input['password'] = bcrypt($input['password']);
         $query = $this->model->create($input);
         $result = $query->id;
     } else {
         $input['active'] = $input['active'];
         $input['group_id'] = $input['group_id'];
         if (\Input::hasFile('photo')) {
             $input['photo'] = isset($photo) ? $photo : "";
         }
         if (isset($input['password']) && $input['password'] != "") {
             $input['password'] = bcrypt($input['password']);
         }
         $this->model->find($id)->update($input);
         $result = $id;
     }
     $save_continue = \Input::get('save_continue');
     $redirect = empty($save_continue) ? $this->url : $this->url . '/edit/' . $result;
     return redirect($redirect)->with('message', 'Admin saved successfully!');
 }
开发者ID:Abdulhmid,项目名称:imageup,代码行数:31,代码来源:UsersController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateEventRequest $req)
 {
     $input = $req->all();
     // Makes sure chair_id enters database as an integer or null if left empty.
     strcmp($input['chair_id'], "") == 0 ? $input['chair_id'] = null : ($input['chair_id'] = (int) $input['chair_id']);
     // Ensures database times are always in UTC.
     foreach ($input as $key => $value) {
         // Ensures only time fields are changed.
         if (!strpos($key, 'time')) {
             continue;
         }
         // Converts time from PST to UTC.
         $pst = new Carbon($value, 'America/Los_Angeles');
         $utc = $pst->setTimezone('UTC');
         // Sets date/time string back into values for database.
         $input[$key] = $utc->toDateTimeString();
     }
     $input['creator_id'] = \Auth::id();
     // Set creator ID by default
     // Set default close time if needed
     if (!isset($input['close_time'])) {
         $input['close_time'] = $input['start_time'];
     }
     // Set default open time if needed
     if (!isset($input['open_time'])) {
         $input['open_time'] = Carbon::now();
     }
     // Create event
     $event = Event::create($input);
     return redirect()->action('EventsController@show', $event->slug);
 }
开发者ID:natalieduong,项目名称:konnection,代码行数:36,代码来源:EventsController.php

示例5: create

 public function create()
 {
     if (Auth::check()) {
         return Redirect::to("/admin");
     }
     return View::make("sessions.create");
 }
开发者ID:cbt36594,项目名称:LaravelPartice,代码行数:7,代码来源:HomeController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $campaign = \Session::get('campaign');
     $campaign->fillRelations();
     foreach ($campaign->getRelations() as $relation) {
         foreach ($relation as $title => $components) {
             //Split it out into human readable terms
             $pieces = explode('\\', $title);
             $title_component = $pieces[count($pieces) - 1];
             $data['objects'][$title_component] = $components;
         }
     }
     $data['campaigns'] = CampaignMembership::where('user_id', \Auth::user()->id)->get();
     foreach ($data['campaigns'] as $campaign) {
         $campaign->details;
     }
     $data['object_count'] = count($data['objects']);
     $data['columns'] = 5;
     $data['logs'] = QuestLog::where('campaign_id', \Session::get('campaign')->id)->orderBy('id', 'desc')->get();
     //Let's remove restricted content for non dms
     foreach ($data['logs'] as $key => $value) {
         foreach ($value as $component) {
             if ($value->restricted == 1 && \Session::get('dm') == 0) {
                 unset($data['logs'][$key]);
             }
         }
     }
     return view('dashboards.index')->with($data);
 }
开发者ID:shairozan,项目名称:oSPITE,代码行数:34,代码来源:DashboardsController.php

示例7: favorites

 public function favorites()
 {
     $favorites = \Auth::user()->sqls()->get();
     $page_title = 'SQL';
     $page_description = 'Favorites';
     return view('sql.favorites', compact('favorites', 'page_title', 'page_description'));
 }
开发者ID:sloan58,项目名称:uc-insight-esk,代码行数:7,代码来源:SqlController.php

示例8: getCreate

 public function getCreate(Request $request)
 {
     $accounts = \App\Account::where('user_id', '=', \Auth::id())->find($request->id);
     $transactions = new \App\Transaction();
     $categories = ['Deposit/Credit', 'Automobile', 'Groceries', 'Health & Beauty', 'Home Improvement', 'Meals & Entertainment', 'Medical Expense', 'Utilities', 'Insurance', 'Miscellaneous'];
     return view('transaction.create')->with('transactions', $transactions)->with(['categories' => $categories])->with('accounts', $accounts);
 }
开发者ID:trietvu,项目名称:p4,代码行数:7,代码来源:TransactionController.php

示例9: handleFacebookCallback

 public function handleFacebookCallback()
 {
     //Since its the same callback function for registration & login. Check prev url and handle appropriately
     $prevUrl = session()->previousUrl();
     $facebookUser = Socialize::with('facebook')->user();
     $appUser = User::whereEmail($facebookUser->getEmail())->get();
     if (strpos($prevUrl, "register")) {
         //If user is not already registered, register and login
         if ($appUser->count() == 0) {
             $user = User::create(['name' => $facebookUser->getName(), 'email' => $facebookUser->getEmail(), 'password' => str_random(8)]);
             $user->verified = true;
             $user->token = null;
             $user->save();
             session()->flash('message', 'You are now registered. Please update your account details.');
             \Auth::loginUsingId($user->id);
             return redirect('/myAccount');
         } else {
             return redirect()->back()->withErrors('User already exists');
         }
     } else {
         if ($appUser->count() == 0) {
             return redirect()->back()->withErrors('User not found');
         }
         $user = $appUser[0];
     }
     \Auth::loginUsingId($user->id);
     return redirect()->intended('/dashboard');
 }
开发者ID:abada,项目名称:SettleUp-Laravel,代码行数:28,代码来源:RegistrationController.php

示例10: inbox

 public function inbox()
 {
     $name = \Auth::user()->name;
     $results = \DB::select('select * from notification.inbox_' . $name . ' order by created_at desc limit 70 offset 0');
     \DB::update('update notification.inbox_' . $name . ' set n_read = true');
     return view('profile.inbox')->with('results', $results);
 }
开发者ID:chandrairawan,项目名称:nosproject,代码行数:7,代码来源:ProfileController.php

示例11: refresh

 public function refresh()
 {
     $count = Message::where('id_receive', \Auth::user()->id)->where('read', NULL)->count();
     if ($count) {
         return $count;
     }
 }
开发者ID:zluy4yvak,项目名称:chat,代码行数:7,代码来源:HomeController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $pro_exc = PromotionExceptional::where('user_id', \Auth::user()->id)->first();
     if ($pro_exc) {
         $pro_exc->start = Carbon::parse($request->start);
         $pro_exc->end = Carbon::parse($request->end);
         $pro_exc->user_id = \Auth::user()->id;
         $pro_exc->price = $request->prix_exc;
         $pro_exc->active = 1;
         $pro_exc->save();
     } else {
         $pro_exc = new PromotionExceptional();
         $pro_exc->start = Carbon::parse($request->start);
         $pro_exc->end = Carbon::parse($request->end);
         $pro_exc->price = $request->prix_exc;
         $pro_exc->user_id = \Auth::user()->id;
         $pro_exc->active = 1;
         $pro_exc->save();
     }
     // make promotion in advance not current
     $pro_adv = PromotionAdvance::where('user_id', \Auth::user()->id)->get();
     if (!$pro_adv->isEmpty()) {
         foreach ($pro_adv as $item) {
             $pv = PromotionAdvance::where('user_id', \Auth::user()->id)->where('id', $item->id)->first();
             $pv->active = 0;
             $pv->save();
         }
     }
     return redirect()->back()->with('success', 'Bien Enregistrée');
 }
开发者ID:khaleader,项目名称:creche,代码行数:36,代码来源:PromotionExceptionalsController.php

示例13: index

 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     if (\Auth::guest()) {
         return redirect()->action('HomeController@index');
     }
     return redirect('auth/login');
 }
开发者ID:clubttt,项目名称:ProjectHealth,代码行数:12,代码来源:WelcomeController.php

示例14: index

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $user = \Auth::user();
     $friends = $user->friends()->get();
     $comments = $user->comments()->get();
     return view('users.show')->with(["user" => $user, "friends" => $friends, 'comments' => $comments]);
 }
开发者ID:mikebywater,项目名称:m8d8,代码行数:12,代码来源:HomeController.php

示例15: editQuestion

 /**
  * edit the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function editQuestion($id)
 {
     $question = \App\Question::find($id);
     $fiche_id = Session::get('fiche_id');
     $user = \Auth::user();
     return view('back.editQuestion', compact('question', 'fiche_id', 'user'));
 }
开发者ID:Vever,项目名称:projetLycee2015,代码行数:13,代码来源:QuestionController.php


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