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
86fce099
Commit
86fce099
authored
Apr 26, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed belongs_to primary key bug.
parent
ca065823
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
laravel/database/eloquent/model.php
+4
-0
laravel/database/eloquent/relationships/belongs_to.php
+1
-1
laravel/documentation/changes.md
+1
-1
No files found.
laravel/database/eloquent/model.php
View file @
86fce099
...
...
@@ -390,6 +390,8 @@ abstract class Model {
$query
=
$this
->
query
()
->
where
(
static
::
$key
,
'='
,
$this
->
get_key
());
$result
=
$query
->
update
(
$this
->
get_dirty
())
===
1
;
if
(
$result
)
$this
->
fire_event
(
'updated'
);
}
// If the model does not exist, we will insert the record and retrieve the last
...
...
@@ -402,6 +404,8 @@ abstract class Model {
$this
->
set_key
(
$id
);
$this
->
exists
=
$result
=
is_numeric
(
$this
->
get_key
());
if
(
$result
)
$this
->
fire_event
(
'created'
);
}
// After the model has been "saved", we will set the original attributes to
...
...
laravel/database/eloquent/relationships/belongs_to.php
View file @
86fce099
...
...
@@ -32,7 +32,7 @@ class Belongs_To extends Relationship {
*/
protected
function
constrain
()
{
$this
->
table
->
where
(
$this
->
base
->
key
(),
'='
,
$this
->
foreign_value
());
$this
->
table
->
where
(
$this
->
model
->
key
(),
'='
,
$this
->
foreign_value
());
}
/**
...
...
laravel/documentation/changes.md
View file @
86fce099
...
...
@@ -61,7 +61,7 @@
-
`Schema::drop`
now accepts
`$connection`
as second parameter.
-
Added
`Input::merge`
method.
-
Added
`Input::replace`
method.
-
Added
`eloquent.saved`
,
`eloquent.saving`
,
`eloquent.deleting`
, and
`eloquent.deleted`
events to Eloquent models
.
-
Added
saving, saved, updating, creating, deleting, and deleted events to Eloquent
.
<a
name=
"upgrade-3.2"
></a>
## Upgrading From 3.1
...
...
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