Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
2ac5a372
Commit
2ac5a372
authored
Sep 28, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up eloquent models.
parent
b93a1220
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
laravel/database/eloquent/model.php
+6
-4
No files found.
laravel/database/eloquent/model.php
View file @
2ac5a372
...
...
@@ -147,7 +147,7 @@ abstract class Model {
// Since this method is only used for instantiating models for querying
// purposes, we will go ahead and set the Query instance on the model.
$model
->
query
=
IoC
::
core
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
$model
->
query
=
IoC
::
co
ntainer
()
->
co
re
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
return
$model
;
}
...
...
@@ -361,7 +361,7 @@ abstract class Model {
// Since the model was instantiated using "new", a query instance has not been set.
// Only models being used for querying have their query instances set by default.
$this
->
query
=
IoC
::
core
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
$this
->
query
=
IoC
::
co
ntainer
()
->
co
re
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
if
(
property_exists
(
$model
,
'timestamps'
)
and
$model
::
$timestamps
)
{
...
...
@@ -410,7 +410,9 @@ abstract class Model {
// delete statement to the query instance.
if
(
!
$this
->
exists
)
return
$this
->
query
->
delete
();
return
IoC
::
core
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
$table
=
static
::
table
(
get_class
(
$this
));
return
IoC
::
container
()
->
core
(
'database'
)
->
connection
(
static
::
$connection
)
->
table
(
$table
)
->
delete
(
$this
->
id
);
}
/**
...
...
@@ -487,7 +489,7 @@ abstract class Model {
// All of the aggregate and persistance functions can be passed directly to the query
// instance. For these functions, we can simply return the response of the query.
if
(
in_array
(
$method
,
array
(
'insert'
,
'update'
,
'count'
,
'sum'
,
'min'
,
'max'
,
'avg'
)))
if
(
in_array
(
$method
,
array
(
'insert'
,
'update'
,
'
abs'
,
'
count'
,
'sum'
,
'min'
,
'max'
,
'avg'
)))
{
return
call_user_func_array
(
array
(
$this
->
query
,
$method
),
$parameters
);
}
...
...
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