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
ba4d1a89
Commit
ba4d1a89
authored
Mar 26, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed add_ magic method from eloquent model as this will be a 3.2 feature.
parent
a915e24b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
12 deletions
+58
-12
blade.php
laravel/blade.php
+28
-0
model.php
laravel/database/eloquent/model.php
+29
-11
relationship.php
laravel/database/eloquent/relationships/relationship.php
+1
-1
No files found.
laravel/blade.php
View file @
ba4d1a89
...
...
@@ -17,6 +17,8 @@ class Blade {
'structure_closings'
,
'else'
,
'includes'
,
'render_each'
,
'render'
,
'yields'
,
'yield_sections'
,
'section_start'
,
...
...
@@ -265,6 +267,32 @@ class Blade {
return
preg_replace
(
$pattern
,
'$1<?php echo view$2->with(get_defined_vars()); ?>'
,
$value
);
}
/**
* Rewrites Blade @render statements into valid PHP.
*
* @param string $value
* @return string
*/
protected
static
function
compile_render
(
$value
)
{
$pattern
=
static
::
matcher
(
'render'
);
return
preg_replace
(
$pattern
,
'$1<?php echo render$2; ?>'
,
$value
);
}
/**
* Rewrites Blade @render_each statements into valid PHP.
*
* @param string $value
* @return string
*/
protected
static
function
compile_render_each
(
$value
)
{
$pattern
=
static
::
matcher
(
'render_each'
);
return
preg_replace
(
$pattern
,
'$1<?php echo render_each$2; ?>'
,
$value
);
}
/**
* Rewrites Blade @yield statements into Section statements.
*
...
...
laravel/database/eloquent/model.php
View file @
ba4d1a89
...
...
@@ -136,9 +136,9 @@ abstract class Model {
}
}
// If the original attribute values have not been set, we will set
them to
// the
values passed to this method allowing us to quickly check if the
//
model has changed since hydration of the original instance
.
// If the original attribute values have not been set, we will set
// the
m to the values passed to this method allowing us to easily
//
check if the model has changed since hydration
.
if
(
count
(
$this
->
original
)
===
0
)
{
$this
->
original
=
$this
->
attributes
;
...
...
@@ -308,6 +308,32 @@ abstract class Model {
return
new
Has_Many_And_Belongs_To
(
$this
,
$model
,
$table
,
$foreign
,
$other
);
}
/**
* Save the model and all of its relations to the database.
*
* @return bool
*/
public
function
push
()
{
$this
->
save
();
// To sync all of the relationships to the database, we will simply spin through
// the relationships, calling the "push" method on each of the models in that
// given relationship, this should ensure that each model is saved.
foreach
(
$this
->
relationships
as
$name
=>
$models
)
{
if
(
!
is_array
(
$models
))
{
$models
=
array
(
$models
);
}
foreach
(
$models
as
$model
)
{
$model
->
push
();
}
}
}
/**
* Save the model instance to the database.
*
...
...
@@ -612,14 +638,6 @@ abstract class Model {
$this
->
attributes
[
substr
(
$method
,
4
)]
=
$parameters
[
0
];
}
// If the method begins with "add_", we will assume that the developer is
// adding a related model instance to the model. This is useful for
// adding all of the related models and then saving at once.
elseif
(
starts_with
(
$method
,
'add_'
))
{
$this
->
relationships
[
substr
(
$method
,
4
)][]
=
$parameters
[
0
];
}
// Finally we will assume that the method is actually the beginning of a
// query, such as "where", and will create a new query instance and
// call the method on the query instance, returning it after.
...
...
laravel/database/eloquent/relationships/relationship.php
View file @
ba4d1a89
...
...
@@ -96,7 +96,7 @@ abstract class Relationship extends Query {
*
* @return string
*/
p
rotected
function
foreign_key
()
p
ublic
function
foreign_key
()
{
return
static
::
foreign
(
$this
->
base
,
$this
->
foreign
);
}
...
...
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