Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
7da624e0
Commit
7da624e0
authored
Aug 09, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added better inline docs to the Auth class.
parent
59dab32c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
auth.php
system/auth.php
+38
-2
No files found.
system/auth.php
View file @
7da624e0
...
@@ -10,7 +10,13 @@ class Auth {
...
@@ -10,7 +10,13 @@ class Auth {
/**
/**
* The current user of the application.
* The current user of the application.
*
*
* If no user is logged in, this variable will be NULL. Otherwise, it will contain
* the result of the "by_id" closure in the authentication configuration file.
*
* However, the user should typically be accessed via the "user" method.
*
* @var object
* @var object
* @see user()
*/
*/
public
static
$user
;
public
static
$user
;
...
@@ -24,7 +30,15 @@ class Auth {
...
@@ -24,7 +30,15 @@ class Auth {
/**
/**
* Determine if the current user of the application is authenticated.
* Determine if the current user of the application is authenticated.
*
*
* <code>
* if (Auth::check())
* {
* // The user is logged in...
* }
* </code>
*
* @return bool
* @return bool
* @see login
*/
*/
public
static
function
check
()
public
static
function
check
()
{
{
...
@@ -34,9 +48,16 @@ class Auth {
...
@@ -34,9 +48,16 @@ class Auth {
/**
/**
* Get the current user of the application.
* Get the current user of the application.
*
*
* The user will be loaded using the user ID stored in the session.
* To retrieve the user, the user ID stored in the session will be passed to
* the "by_id" closure in the authentication configuration file. The result
* of the closure will be cached and returned.
*
* <code>
* $email = Auth::user()->email;
* </code>
*
*
* @return object
* @return object
* @see $user
*/
*/
public
static
function
user
()
public
static
function
user
()
{
{
...
@@ -54,8 +75,20 @@ class Auth {
...
@@ -54,8 +75,20 @@ class Auth {
* If the user credentials are valid. The user ID will be stored in the session
* If the user credentials are valid. The user ID will be stored in the session
* and will be considered "logged in" on subsequent requests to the application.
* and will be considered "logged in" on subsequent requests to the application.
*
*
* The password passed to the method should be plain text, as it will be hashed
* by the Hash class when authenticating.
*
* <code>
* if (Auth::login('test@gmail.com', 'secret'))
* {
* // The credentials are valid...
* }
* </code>
*
* @param string $username
* @param string $username
* @param string $password
* @param string $password
* @return bool
* @see Hash::check()
*/
*/
public
static
function
login
(
$username
,
$password
)
public
static
function
login
(
$username
,
$password
)
{
{
...
@@ -75,7 +108,10 @@ class Auth {
...
@@ -75,7 +108,10 @@ class Auth {
}
}
/**
/**
* Logout the user of the application.
* Log the user out of the application.
*
* The user ID will be removed from the session and the user will no longer
* be considered logged in on subsequent requests.
*
*
* @return void
* @return void
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment