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
17727a22
Commit
17727a22
authored
Aug 14, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename eloquent::model to eloquent::model_name
parent
914b60e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
auth.php
system/auth.php
+5
-5
model.php
system/db/eloquent/model.php
+6
-6
No files found.
system/auth.php
View file @
17727a22
...
...
@@ -79,7 +79,7 @@ class Auth {
* by the Hash class when authenticating.
*
* <code>
* if (Auth::
attempt
('test@gmail.com', 'secret'))
* if (Auth::
login
('test@gmail.com', 'secret'))
* {
* // The credentials are valid...
* }
...
...
@@ -90,13 +90,13 @@ class Auth {
* @return bool
* @see Hash::check()
*/
public
static
function
attempt
(
$username
,
$password
)
public
static
function
login
(
$username
,
$password
)
{
if
(
!
is_null
(
$user
=
call_user_func
(
Config
::
get
(
'auth.by_username'
),
$username
)))
{
if
(
Hash
::
check
(
$password
,
$user
->
password
))
{
static
::
login
(
$user
);
static
::
remember
(
$user
);
return
true
;
}
...
...
@@ -106,7 +106,7 @@ class Auth {
}
/**
* Log
in a given user into the application
.
* Log
a user into the application without checking credentials
.
*
* The user's ID will be stored in the session and the user will be considered
* "logged in" on subsequent requests to the application.
...
...
@@ -116,7 +116,7 @@ class Auth {
* @param object $user
* @return void
*/
public
static
function
login
(
$user
)
public
static
function
remember
(
$user
)
{
static
::
$user
=
$user
;
...
...
system/db/eloquent/model.php
View file @
17727a22
...
...
@@ -150,7 +150,7 @@ abstract class Model {
{
if
(
property_exists
(
$class
,
'table'
))
return
$class
::
$table
;
return
strtolower
(
Inflector
::
plural
(
static
::
model
(
$class
)));
return
strtolower
(
Inflector
::
plural
(
static
::
model
_name
(
$class
)));
}
/**
...
...
@@ -159,7 +159,7 @@ abstract class Model {
* @param string|Model $model
* @return string
*/
public
static
function
model
(
$model
)
public
static
function
model
_name
(
$model
)
{
$class
=
(
is_object
(
$model
))
?
get_class
(
$model
)
:
$model
;
...
...
@@ -268,7 +268,7 @@ abstract class Model {
*/
private
function
has_one_or_many
(
$model
,
$foreign_key
)
{
$this
->
relating_key
=
(
is_null
(
$foreign_key
))
?
strtolower
(
static
::
model
(
$this
))
.
'_id'
:
$foreign_key
;
$this
->
relating_key
=
(
is_null
(
$foreign_key
))
?
strtolower
(
static
::
model
_name
(
$this
))
.
'_id'
:
$foreign_key
;
return
static
::
query
(
$model
)
->
where
(
$this
->
relating_key
,
'='
,
$this
->
id
);
}
...
...
@@ -322,11 +322,11 @@ abstract class Model {
// Allowing the overriding of the foreign and associated keys provides the flexibility for
// self-referential many-to-many relationships, such as a "buddy list".
$this
->
relating_key
=
(
is_null
(
$foreign_key
))
?
strtolower
(
static
::
model
(
$this
))
.
'_id'
:
$foreign_key
;
$this
->
relating_key
=
(
is_null
(
$foreign_key
))
?
strtolower
(
static
::
model
_name
(
$this
))
.
'_id'
:
$foreign_key
;
// The associated key is the foreign key name of the related model. So, if the related model
// is "Role", the associated key on the intermediate table would be "role_id".
$associated_key
=
(
is_null
(
$associated_key
))
?
strtolower
(
static
::
model
(
$model
))
.
'_id'
:
$associated_key
;
$associated_key
=
(
is_null
(
$associated_key
))
?
strtolower
(
static
::
model
_name
(
$model
))
.
'_id'
:
$associated_key
;
return
static
::
query
(
$model
)
->
select
(
array
(
static
::
table
(
$model
)
.
'.*'
))
...
...
@@ -345,7 +345,7 @@ abstract class Model {
*/
private
function
intermediate_table
(
$model
)
{
$models
=
array
(
Inflector
::
plural
(
static
::
model
(
$model
)),
Inflector
::
plural
(
static
::
model
(
$this
)));
$models
=
array
(
Inflector
::
plural
(
static
::
model
_name
(
$model
)),
Inflector
::
plural
(
static
::
model_name
(
$this
)));
sort
(
$models
);
...
...
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