Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
laravelshoppingcart
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
package
laravelshoppingcart
Commits
78f13726
Commit
78f13726
authored
Jul 28, 2016
by
Thorsten Buss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add __isset() to the __get() functions +FIX if condition key on item does not exists
parent
cb952a9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
Attribute.php
src/Cart/Attribute.php
+5
-0
Condition.php
src/Cart/Condition.php
+3
-0
Item.php
src/Cart/Item.php
+7
-2
No files found.
src/Cart/Attribute.php
View file @
78f13726
...
...
@@ -15,4 +15,9 @@ class Attribute extends Collection {
if
(
$this
->
has
(
$name
))
return
$this
->
get
(
$name
);
return
null
;
}
public
function
__isset
(
$name
)
{
return
$this
->
has
(
$name
);
}
}
\ No newline at end of file
src/Cart/Condition.php
View file @
78f13726
...
...
@@ -224,4 +224,7 @@ class Condition extends Collection {
return
null
;
}
public
function
__isset
(
$name
)
{
return
$this
->
has
(
$name
);
}
}
\ No newline at end of file
src/Cart/Item.php
View file @
78f13726
...
...
@@ -28,10 +28,10 @@ class Item extends Collection {
*/
public
function
__construct
(
$attributes
)
{
// make conditions as array and set target to item if not set
if
(
isset
(
$attributes
[
'conditions'
])
&&
!
empty
(
$attributes
[
'conditions'
]))
if
(
isset
(
$attributes
[
'conditions'
])
&&
!
empty
(
$attributes
[
'conditions'
]))
{
if
(
!
is_array
(
$attributes
[
'conditions'
]))
$attributes
[
'conditions'
]
=
[
$attributes
[
'conditions'
]];
collect
(
$attributes
[
'conditions'
])
->
transform
(
function
(
$condition
)
{
collect
(
$attributes
[
'conditions'
])
->
transform
(
function
(
$condition
)
{
if
(
$condition
instanceof
Condition
)
{
if
(
$condition
->
getTarget
()
==
'cart'
)
return
false
;
...
...
@@ -39,6 +39,7 @@ class Item extends Collection {
}
else
$condition
[
'target'
]
=
'item'
;
});
}
parent
::
__construct
(
$attributes
);
}
...
...
@@ -62,6 +63,10 @@ class Item extends Collection {
return
null
;
}
public
function
__isset
(
$name
)
{
return
$this
->
has
(
$name
);
}
/**
* check if item has conditions
*
...
...
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