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
7518088f
Commit
7518088f
authored
Sep 03, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use service location in eloquent models to resolve the database manager.
parent
6281c8c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
model.php
laravel/database/eloquent/model.php
+3
-4
No files found.
laravel/database/eloquent/model.php
View file @
7518088f
...
...
@@ -2,7 +2,6 @@
use
Laravel\Str
;
use
Laravel\Inflector
;
use
Laravel\Database\Manager
;
abstract
class
Model
{
...
...
@@ -133,7 +132,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
=
Manager
::
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
$model
->
query
=
IoC
::
resolve
(
'laravel.database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
return
$model
;
}
...
...
@@ -347,7 +346,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
=
Manager
::
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
$this
->
query
=
IoC
::
resolve
(
'laravel.database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
if
(
property_exists
(
$model
,
'timestamps'
)
and
$model
::
$timestamps
)
{
...
...
@@ -396,7 +395,7 @@ abstract class Model {
// delete statement to the query instance.
if
(
!
$this
->
exists
)
return
$this
->
query
->
delete
();
return
Manager
::
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
return
IoC
::
resolve
(
'laravel.database'
)
->
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