在laravel 5.3上AuthenticatesUsers在哪里?

时间:2016-09-26 06:00:29

标签: php laravel

我在laravel 5.3用户make:auth中构建基本的Auth。在laravel 5.3中,他们将登录和注册控制器分开到id="UserStatus"<?php //Set API user and password $API_USER = 'username'; $API_PASS = 'password'; //Set parameters to make cURL call to Duda $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, 'sampleurl'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $API_USER.':'.$API_PASS); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); //execute cURL call and get template data $output = curl_exec($ch); //check for errors in cURL if(curl_errno($ch)) { die('Curl error: ' . curl_error($ch)); } //echo $output; print_r($output); ?>

以下是我的<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Ajax Preview</title> <script src="https://code.jquery.com/jquery-3.1.0.js"></script> <script> $(function() { var $data = $('#content'); $.ajax({ method:'GET', dataType:'json', url:'https://syncslider-ehnoxx07.c9users.io/temp.json', success: function (data) { $.each(data, function(i,data){ $data.html('<img src=' + data.thumbnail_url + '>'); }); } }); }); </script> </head> <body> <div id="content"></div> </body> </html>

Auth\LoginController

问题在于我尝试在Auth\RegisterController中编辑Auth\LoginController,但根本没有受到影响。我甚至尝试在<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; class LoginController extends Controller { use AuthenticatesUsers; /** * Where to redirect users after login / registration. * * @var string */ protected $redirectTo = '/home'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest', ['except' => 'logout']); } } 上重命名类/特征名称,但脚本仍然有用。

那么实际AuthenticatesUsers在哪里?因为我的sublime只能找到一个具有该名称的文件。

谢谢

1 个答案:

答案 0 :(得分:3)

只有一个AuthenticatesUsers,它将在vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php中。如果您正在编辑它并且它没有任何效果,那么您可以在另一个项目中编辑该文件。

值得注意的是,永远不应编辑此文件。 vendor/文件夹中的所有内容都应保持原样,因为当Composer运行时,它将替换您所做的任何更改。如果您想进行更改,则应扩展或覆盖您需要的方法。