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
2aef4de8
Commit
2aef4de8
authored
Aug 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring Eloquent.
parent
db391b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
model.php
system/db/eloquent/model.php
+4
-13
No files found.
system/db/eloquent/model.php
View file @
2aef4de8
...
@@ -146,10 +146,7 @@ abstract class Model {
...
@@ -146,10 +146,7 @@ abstract class Model {
*/
*/
public
static
function
table
(
$class
)
public
static
function
table
(
$class
)
{
{
if
(
property_exists
(
$class
,
'table'
))
if
(
property_exists
(
$class
,
'table'
))
return
$class
::
$table
;
{
return
$class
::
$table
;
}
return
strtolower
(
Inflector
::
plural
(
static
::
model
(
$class
)));
return
strtolower
(
Inflector
::
plural
(
static
::
model
(
$class
)));
}
}
...
@@ -400,10 +397,7 @@ abstract class Model {
...
@@ -400,10 +397,7 @@ abstract class Model {
{
{
$this
->
updated_at
=
date
(
'Y-m-d H:i:s'
);
$this
->
updated_at
=
date
(
'Y-m-d H:i:s'
);
if
(
!
$this
->
exists
)
if
(
!
$this
->
exists
)
$this
->
created_at
=
$this
->
updated_at
;
{
$this
->
created_at
=
$this
->
updated_at
;
}
}
}
/**
/**
...
@@ -418,12 +412,9 @@ abstract class Model {
...
@@ -418,12 +412,9 @@ abstract class Model {
// that model. If it is being called from an Eloquent query model, it is probably
// that model. If it is being called from an Eloquent query model, it is probably
// the developer's intention to delete more than one model, so we will pass the
// the developer's intention to delete more than one model, so we will pass the
// delete statement to the query instance.
// delete statement to the query instance.
if
(
$this
->
exists
)
if
(
!
$this
->
exists
)
return
$this
->
query
->
delete
();
{
return
Manager
::
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
}
return
$this
->
query
->
delete
(
);
return
Manager
::
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
}
}
/**
/**
...
...
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