Skip to content

Commit 8cab820

Browse files
committed
continue working for 5.2 compatibility
1 parent fce8dc3 commit 8cab820

File tree

9 files changed

+184
-176
lines changed

9 files changed

+184
-176
lines changed

src/Darryldecode/Backend/Base/Registrar/Registrar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Registrar {
1313
/**
1414
* the laravel backend version
1515
*/
16-
const VERSION = '1.0.28';
16+
const VERSION = '2.0.0';
1717
const VERSION_NAME = 'Alpha';
1818

1919
/**

src/Darryldecode/Backend/Components/ContentBuilder/Controllers/ContentController.php

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
namespace Darryldecode\Backend\Components\ContentBuilder\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentCommand;
13+
use Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteContentCommand;
14+
use Darryldecode\Backend\Components\ContentBuilder\Commands\QueryContentsCommand;
15+
use Darryldecode\Backend\Components\ContentBuilder\Commands\UpdateContentCommand;
1216
use Illuminate\Http\Request;
1317
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1418

@@ -45,13 +49,22 @@ public function getByType($contentType)
4549
{
4650
if( $this->request->ajax() )
4751
{
48-
$result = $this->dispatchFrom(
49-
'Darryldecode\Backend\Components\ContentBuilder\Commands\QueryContentsCommand',
50-
$this->request,
51-
array(
52-
'type' => $contentType,
53-
)
54-
);
52+
$result = $this->dispatch(new QueryContentsCommand(
53+
$contentType,
54+
$this->request->get('status','any'),
55+
$this->request->get('authorId',null),
56+
$this->request->get('terms',array()),
57+
$this->request->get('meta',array()),
58+
$this->request->get('paginated',true),
59+
$this->request->get('perPage',8),
60+
$this->request->get('sortBy','created_at'),
61+
$this->request->get('sortOrder','DESC'),
62+
$this->request->get('with',array()),
63+
$this->request->get('disablePermissionChecking',false),
64+
$this->request->get('startDate',null),
65+
$this->request->get('endDate',null),
66+
$this->request->get('queryHook',null)
67+
));
5568

5669
return $this->response->json(array(
5770
'data' => $result->getData()->toArray(),
@@ -71,10 +84,18 @@ public function getByType($contentType)
7184
*/
7285
public function postCreate()
7386
{
74-
$result = $this->dispatchFrom(
75-
'Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentCommand',
76-
$this->request
77-
);
87+
$result = $this->dispatch(new CreateContentCommand(
88+
$this->request->get('title'),
89+
$this->request->get('body'),
90+
$this->request->get('slug'),
91+
$this->request->get('status'),
92+
$this->request->get('authorId'),
93+
$this->request->get('contentTypeId'),
94+
$this->request->get('permissionRequirements',null),
95+
$this->request->get('taxonomies'),
96+
$this->request->get('miscData'),
97+
false
98+
));
7899

79100
return $this->response->json(array(
80101
'data' => $result->getData()->toArray(),
@@ -90,11 +111,20 @@ public function postCreate()
90111
*/
91112
public function putUpdate($id)
92113
{
93-
$result = $this->dispatchFrom(
94-
'Darryldecode\Backend\Components\ContentBuilder\Commands\UpdateContentCommand',
95-
$this->request,
96-
array('id' => $id)
97-
);
114+
$result = $this->dispatch(new UpdateContentCommand(
115+
$id,
116+
$this->request->get('title',null),
117+
$this->request->get('body',null),
118+
$this->request->get('slug',null),
119+
$this->request->get('status',null),
120+
$this->request->get('authorId',null),
121+
$this->request->get('contentTypeId',null),
122+
$this->request->get('permissionRequirements',null),
123+
$this->request->get('taxonomies',null),
124+
$this->request->get('miscData',null),
125+
$this->request->get('metaData',null),
126+
false
127+
));
98128

99129
return $this->response->json(array(
100130
'data' => $result->getData()->toArray(),
@@ -110,12 +140,10 @@ public function putUpdate($id)
110140
*/
111141
public function delete($id)
112142
{
113-
$result = $this->dispatchFromArray(
114-
'Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteContentCommand',
115-
array(
116-
'id' => $id
117-
)
118-
);
143+
$result = $this->dispatch(new DeleteContentCommand(
144+
$id,
145+
false
146+
));
119147

120148
return $this->response->json(array(
121149
'data' => $result->getData()->toArray(),

src/Darryldecode/Backend/Components/ContentBuilder/Controllers/ContentTaxonomyController.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
namespace Darryldecode\Backend\Components\ContentBuilder\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentTypeTaxonomyCommand;
13+
use Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteTaxonomyCommand;
1214
use Illuminate\Http\Request;
1315
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1416

@@ -42,15 +44,12 @@ public function __construct(Request $request, Response $response)
4244
*/
4345
public function postCreate()
4446
{
45-
$result = $this->dispatchFromArray(
46-
'Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentTypeTaxonomyCommand',
47-
array(
48-
'taxonomy' => $this->request->get('taxonomy', null),
49-
'description' => $this->request->get('description', null),
50-
'parent' => $this->request->get('parent', null),
51-
'contentTypeId' => $this->request->get('contentTypeId', null),
52-
)
53-
);
47+
$result = $this->dispatch(new CreateContentTypeTaxonomyCommand(
48+
$this->request->get('taxonomy', null),
49+
$this->request->get('description', null),
50+
$this->request->get('contentTypeId', null),
51+
false
52+
));
5453

5554
return $this->response->json(array(
5655
'data' => $result->getData()->toArray(),
@@ -66,12 +65,10 @@ public function postCreate()
6665
*/
6766
public function delete($taxonomyId)
6867
{
69-
$result = $this->dispatchFromArray(
70-
'Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteTaxonomyCommand',
71-
array(
72-
'taxonomyId' => $taxonomyId
73-
)
74-
);
68+
$result = $this->dispatch(new DeleteTaxonomyCommand(
69+
$taxonomyId,
70+
false
71+
));
7572

7673
return $this->response->json(array(
7774
'data' => $result->getData()->toArray(),

src/Darryldecode/Backend/Components/ContentBuilder/Controllers/ContentTaxonomyTermsController.php

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
namespace Darryldecode\Backend\Components\ContentBuilder\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\ContentBuilder\Commands\CreateTypeTaxonomyTerm;
13+
use Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteTaxonomyTermCommand;
14+
use Darryldecode\Backend\Components\ContentBuilder\Commands\QueryTermsByTaxonomyCommand;
1215
use Illuminate\Http\Request;
1316
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1417

@@ -42,12 +45,10 @@ public function __construct(Request $request, Response $response)
4245
*/
4346
public function getByTaxonomyId()
4447
{
45-
$result = $this->dispatchFromArray(
46-
'Darryldecode\Backend\Components\ContentBuilder\Commands\QueryTermsByTaxonomyCommand',
47-
array(
48-
'taxonomyId' => $this->request->get('taxonomyId', null)
49-
)
50-
);
48+
$result = $this->dispatch(new QueryTermsByTaxonomyCommand(
49+
$this->request->get('taxonomyId', null),
50+
false
51+
));
5152

5253
return $this->response->json(array(
5354
'data' => $result->getData()->toArray(),
@@ -62,14 +63,12 @@ public function getByTaxonomyId()
6263
*/
6364
public function postCreate()
6465
{
65-
$result = $this->dispatchFromArray(
66-
'Darryldecode\Backend\Components\ContentBuilder\Commands\CreateTypeTaxonomyTerm',
67-
array(
68-
'term' => $this->request->get('term', null),
69-
'slug' => $this->request->get('slug', null),
70-
'contentTypeTaxonomyId' => $this->request->get('contentTypeTaxonomyId', null),
71-
)
72-
);
66+
$result = $this->dispatch(new CreateTypeTaxonomyTerm(
67+
$this->request->get('term', null),
68+
$this->request->get('slug', null),
69+
$this->request->get('contentTypeTaxonomyId', null),
70+
false
71+
));
7372

7473
return $this->response->json(array(
7574
'data' => $result->getData()->toArray(),
@@ -85,13 +84,11 @@ public function postCreate()
8584
*/
8685
public function delete($id)
8786
{
88-
$result = $this->dispatchFromArray(
89-
'Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteTaxonomyTermCommand',
90-
array(
91-
'taxonomyId' => $this->request->get('taxonomyId', null),
92-
'termId' => $id,
93-
)
94-
);
87+
$result = $this->dispatch(new DeleteTaxonomyTermCommand(
88+
$this->request->get('taxonomyId', null),
89+
$id,
90+
false
91+
));
9592

9693
return $this->response->json(array(
9794
'data' => $result->getData()->toArray(),

src/Darryldecode/Backend/Components/ContentBuilder/Controllers/ContentTypeController.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
namespace Darryldecode\Backend\Components\ContentBuilder\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentTypeCommand;
13+
use Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteContentTypeCommand;
14+
use Darryldecode\Backend\Components\ContentBuilder\Commands\QueryContentTypeCommand;
1215
use Illuminate\Http\Request;
1316
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1417

@@ -44,12 +47,10 @@ public function index()
4447
{
4548
if( $this->request->ajax() )
4649
{
47-
$result = $this->dispatchFromArray(
48-
'Darryldecode\Backend\Components\ContentBuilder\Commands\QueryContentTypeCommand',
49-
array(
50-
'type' => $this->request->get('type', null),
51-
)
52-
);
50+
$result = $this->dispatch(new QueryContentTypeCommand(
51+
$this->request->get('type', null),
52+
false
53+
));
5354

5455
return $this->response->json(array(
5556
'data' => $result->getData()->toArray(),
@@ -69,13 +70,11 @@ public function index()
6970
*/
7071
public function postCreate()
7172
{
72-
$result = $this->dispatchFromArray(
73-
'Darryldecode\Backend\Components\ContentBuilder\Commands\CreateContentTypeCommand',
74-
array(
75-
'type' => $this->request->get('type', null),
76-
'enableRevision' => $this->request->get('enableRevision', false),
77-
)
78-
);
73+
$result = $this->dispatch(new CreateContentTypeCommand(
74+
$this->request->get('type', null),
75+
$this->request->get('enableRevision', 'no'),
76+
false
77+
));
7978

8079
return $this->response->json(array(
8180
'data' => $result->getData()->toArray(),
@@ -91,12 +90,10 @@ public function postCreate()
9190
*/
9291
public function delete($contentTypeId)
9392
{
94-
$result = $this->dispatchFromArray(
95-
'Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteContentTypeCommand',
96-
array(
97-
'contentTypeId' => $contentTypeId,
98-
)
99-
);
93+
$result = $this->dispatch(new DeleteContentTypeCommand(
94+
$contentTypeId,
95+
false
96+
));
10097

10198
return $this->response->json(array(
10299
'data' => $result->getData()->toArray(),

src/Darryldecode/Backend/Components/ContentBuilder/Controllers/ContentTypeFormGroupController.php

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
namespace Darryldecode\Backend\Components\ContentBuilder\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\ContentBuilder\Commands\CreateFormGroupCommand;
13+
use Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteFormGroupCommand;
14+
use Darryldecode\Backend\Components\ContentBuilder\Commands\QueryFormGroupCommand;
15+
use Darryldecode\Backend\Components\ContentBuilder\Commands\UpdateFormGroupCommand;
1216
use Illuminate\Http\Request;
1317
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1418

@@ -44,14 +48,12 @@ public function index()
4448
{
4549
if( $this->request->ajax() )
4650
{
47-
$result = $this->dispatchFromArray(
48-
'Darryldecode\Backend\Components\ContentBuilder\Commands\QueryFormGroupCommand',
49-
array(
50-
'paginated' => $this->request->get('paginated', true),
51-
'perPage' => $this->request->get('perPage', 6),
52-
'contentTypeId' => $this->request->get('contentTypeId', null),
53-
)
54-
);
51+
$result = $this->dispatch(new QueryFormGroupCommand(
52+
$this->request->get('contentTypeId', null),
53+
$this->request->get('paginated', true),
54+
$this->request->get('perPage', 6),
55+
false
56+
));
5557

5658
return $this->response->json(array(
5759
'data' => $result->getData()->toArray(),
@@ -71,16 +73,14 @@ public function index()
7173
*/
7274
public function postCreate()
7375
{
74-
$result = $this->dispatchFromArray(
75-
'Darryldecode\Backend\Components\ContentBuilder\Commands\CreateFormGroupCommand',
76-
array(
77-
'name' => $this->request->get('name', null),
78-
'formName' => $this->request->get('formName', null),
79-
'conditions' => $this->request->get('conditions', array()),
80-
'fields' => $this->request->get('fields', array()),
81-
'contentTypeId' => $this->request->get('contentTypeId', null),
82-
)
83-
);
76+
$result = $this->dispatch(new CreateFormGroupCommand(
77+
$this->request->get('name', null),
78+
$this->request->get('formName', null),
79+
$this->request->get('conditions', array()),
80+
$this->request->get('fields', array()),
81+
$this->request->get('contentTypeId', null),
82+
false
83+
));
8484

8585
return $this->response->json(array(
8686
'data' => $result->getData()->toArray(),
@@ -96,17 +96,15 @@ public function postCreate()
9696
*/
9797
public function putUpdate($formGroupId)
9898
{
99-
$result = $this->dispatchFromArray(
100-
'Darryldecode\Backend\Components\ContentBuilder\Commands\UpdateFormGroupCommand',
101-
array(
102-
'id' => $formGroupId,
103-
'name' => $this->request->get('name', null),
104-
'formName' => $this->request->get('formName', null),
105-
'conditions' => $this->request->get('conditions', array()),
106-
'fields' => $this->request->get('fields', array()),
107-
'contentTypeId' => $this->request->get('contentTypeId', null),
108-
)
109-
);
99+
$result = $this->dispatch(new UpdateFormGroupCommand(
100+
$formGroupId,
101+
$this->request->get('name', null),
102+
$this->request->get('formName', null),
103+
$this->request->get('conditions', array()),
104+
$this->request->get('fields', array()),
105+
$this->request->get('contentTypeId', null),
106+
false
107+
));
110108

111109
return $this->response->json(array(
112110
'data' => $result->getData()->toArray(),
@@ -122,12 +120,10 @@ public function putUpdate($formGroupId)
122120
*/
123121
public function delete($id)
124122
{
125-
$result = $this->dispatchFromArray(
126-
'Darryldecode\Backend\Components\ContentBuilder\Commands\DeleteFormGroupCommand',
127-
array(
128-
'id' => $id,
129-
)
130-
);
123+
$result = $this->dispatch(new DeleteFormGroupCommand(
124+
$id,
125+
false
126+
));
131127

132128
return $this->response->json(array(
133129
'data' => $result->getData()->toArray(),

0 commit comments

Comments
 (0)