Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
63caf34a
Unverified
Commit
63caf34a
authored
Sep 19, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sending the full page entity to the PageWasUpdated event
parent
466daf82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
PageWasUpdated.php
Modules/Page/Events/PageWasUpdated.php
+6
-4
EloquentPageRepository.php
...les/Page/Repositories/Eloquent/EloquentPageRepository.php
+1
-1
EloquentPageRepositoryTest.php
Modules/Page/Tests/EloquentPageRepositoryTest.php
+1
-1
No files found.
Modules/Page/Events/PageWasUpdated.php
View file @
63caf34a
...
...
@@ -2,6 +2,8 @@
namespace
Modules\Page\Events
;
use
Modules\Page\Entities\Page
;
class
PageWasUpdated
{
/**
...
...
@@ -9,13 +11,13 @@ class PageWasUpdated
*/
public
$data
;
/**
* @var
int
* @var
Page
*/
public
$page
Id
;
public
$page
;
public
function
__construct
(
$pageId
,
array
$data
)
public
function
__construct
(
Page
$page
,
array
$data
)
{
$this
->
data
=
$data
;
$this
->
page
Id
=
$pageId
;
$this
->
page
=
$page
;
}
}
Modules/Page/Repositories/Eloquent/EloquentPageRepository.php
View file @
63caf34a
...
...
@@ -81,7 +81,7 @@ class EloquentPageRepository extends EloquentBaseRepository implements PageRepos
event
(
$event
=
new
PageIsUpdating
(
$model
,
$data
));
$model
->
update
(
$event
->
getAttributes
());
event
(
new
PageWasUpdated
(
$model
->
id
,
$data
));
event
(
new
PageWasUpdated
(
$model
,
$data
));
$model
->
setTags
(
array_get
(
$data
,
'tags'
,
[]));
...
...
Modules/Page/Tests/EloquentPageRepositoryTest.php
View file @
63caf34a
...
...
@@ -162,7 +162,7 @@ class EloquentPageRepositoryTest extends BasePageTest
$this
->
page
->
update
(
$page
,
[
'en'
=>
[
'title'
=>
'Better!'
]]);
Event
::
assertDispatched
(
PageWasUpdated
::
class
,
function
(
$e
)
use
(
$page
)
{
return
$e
->
page
I
d
===
$page
->
id
;
return
$e
->
page
->
i
d
===
$page
->
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