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
e96f75e8
Commit
e96f75e8
authored
Mar 22, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing bugs in database layer.
parent
35e53b8c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
relationship.php
laravel/database/eloquent/relationships/relationship.php
+17
-7
table.php
laravel/database/schema/table.php
+1
-1
No files found.
laravel/database/eloquent/relationships/relationship.php
View file @
e96f75e8
...
@@ -24,11 +24,21 @@ abstract class Relationship extends Query {
...
@@ -24,11 +24,21 @@ abstract class Relationship extends Query {
{
{
$this
->
foreign
=
$foreign
;
$this
->
foreign
=
$foreign
;
// We will go ahead and set the model and associated instances on the relationship
// We will go ahead and set the model and associated instances on the
// to match the relationship targets passed in from the model. These will allow
// relationship to match the relationship targets passed in from the
// us to gather more inforamtion on the relationship.
// model. These will allow us to gather the relationship info.
$this
->
model
=
(
$associated
instanceof
Model
)
?
$associated
:
new
$associated
;
if
(
$associated
instanceof
Model
)
{
$this
->
model
=
$associated
;
}
else
{
$this
->
model
=
new
$associated
;
}
// For relationships, we'll set the base model to be the model being
// associated from. This model contains the value of the foreign
// key needed to connect to the associated model.
if
(
$model
instanceof
Model
)
if
(
$model
instanceof
Model
)
{
{
$this
->
base
=
$model
;
$this
->
base
=
$model
;
...
@@ -38,9 +48,9 @@ abstract class Relationship extends Query {
...
@@ -38,9 +48,9 @@ abstract class Relationship extends Query {
$this
->
base
=
new
$model
;
$this
->
base
=
new
$model
;
}
}
// Next we'll set the fluent query builder for the relationship and
constrain
// Next we'll set the fluent query builder for the relationship and
//
the query such that it only returns the models that are appropriate for
//
constrain the query such that it only returns the models that
//
the relationship, typically by setting the foreign key
.
//
are appropriate for the relationship
.
$this
->
table
=
$this
->
query
();
$this
->
table
=
$this
->
query
();
$this
->
constrain
();
$this
->
constrain
();
...
...
laravel/database/schema/table.php
View file @
e96f75e8
...
@@ -136,7 +136,7 @@ class Table {
...
@@ -136,7 +136,7 @@ class Table {
// the index that can be used when dropping indexes.
// the index that can be used when dropping indexes.
if
(
is_null
(
$name
))
if
(
is_null
(
$name
))
{
{
$name
=
$this
->
name
.
implode
(
'_'
,
$columns
)
.
'_'
.
$type
;
$name
=
$this
->
name
.
'_'
.
implode
(
'_'
,
$columns
)
.
'_'
.
$type
;
}
}
return
$this
->
command
(
$type
,
compact
(
'name'
,
'columns'
));
return
$this
->
command
(
$type
,
compact
(
'name'
,
'columns'
));
...
...
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