Skip to content

Commit fce8dc3

Browse files
committed
working on 5.2
1 parent fec3871 commit fce8dc3

File tree

5 files changed

+71
-73
lines changed

5 files changed

+71
-73
lines changed

src/Darryldecode/Backend/Components/Auth/Commands/AuthenticateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Illuminate\Support\Facades\Auth;
1212
use Carbon\Carbon;
1313

14-
class AuthenticateCommand extends Command implements SelfHandling {
14+
class AuthenticateCommand extends Command {
1515
/**
1616
* @var null
1717
*/

src/Darryldecode/Backend/Components/Navigation/Commands/ListNavigationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Illuminate\Contracts\Bus\SelfHandling;
1515
use Illuminate\Support\Collection;
1616

17-
class ListNavigationCommand extends Command implements SelfHandling {
17+
class ListNavigationCommand extends Command {
1818

1919
public function __construct()
2020
{

src/Darryldecode/Backend/Components/Navigation/Controllers/NavigationController.php

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
namespace Darryldecode\Backend\Components\Navigation\Controllers;
1010

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\Navigation\Commands\CreateNavigationCommand;
13+
use Darryldecode\Backend\Components\Navigation\Commands\DeleteCustomNavigationCommand;
14+
use Darryldecode\Backend\Components\Navigation\Commands\ListCustomNavigationCommand;
15+
use Darryldecode\Backend\Components\Navigation\Commands\ListNavigationCommand;
16+
use Darryldecode\Backend\Components\Navigation\Commands\UpdateNavigationCommand;
1217
use Illuminate\Http\Request;
1318
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1419

@@ -42,10 +47,7 @@ public function __construct(Request $request, Response $response)
4247
*/
4348
public function index()
4449
{
45-
$result = $this->dispatchFromArray(
46-
'Darryldecode\Backend\Components\Navigation\Commands\ListNavigationCommand',
47-
array()
48-
);
50+
$result = $this->dispatch(new ListNavigationCommand());
4951

5052
return $this->response->json(array(
5153
'data' => $result->getData()->toArray(),
@@ -62,10 +64,14 @@ public function getNavBuilderDisplay()
6264
{
6365
if( $this->request->ajax() )
6466
{
65-
$result = $this->dispatchFromArray(
66-
'Darryldecode\Backend\Components\Navigation\Commands\ListCustomNavigationCommand',
67-
array()
68-
);
67+
$result = $this->dispatch(new ListCustomNavigationCommand(
68+
null,
69+
true,
70+
8,
71+
'created_at',
72+
'DESC',
73+
false
74+
));
6975

7076
return $this->response->json(array(
7177
'data' => $result->getData()->toArray(),
@@ -87,10 +93,11 @@ public function getNavBuilderDisplay()
8793
*/
8894
public function postCreate()
8995
{
90-
$result = $this->dispatchFrom(
91-
'Darryldecode\Backend\Components\Navigation\Commands\CreateNavigationCommand',
92-
$this->request
93-
);
96+
$result = $this->dispatch(new CreateNavigationCommand(
97+
$this->request->get('name'),
98+
$this->request->get('data'),
99+
false
100+
));
94101

95102
return $this->response->json(array(
96103
'data' => $result->getData()->toArray(),
@@ -106,13 +113,12 @@ public function postCreate()
106113
*/
107114
public function putUpdate($id)
108115
{
109-
$result = $this->dispatchFrom(
110-
'Darryldecode\Backend\Components\Navigation\Commands\UpdateNavigationCommand',
111-
$this->request,
112-
array(
113-
'id' => $id
114-
)
115-
);
116+
$result = $this->dispatch(new UpdateNavigationCommand(
117+
$id,
118+
$this->request->get('name'),
119+
$this->request->get('data'),
120+
false
121+
));
116122

117123
return $this->response->json(array(
118124
'data' => $result->getData()->toArray(),
@@ -128,12 +134,7 @@ public function putUpdate($id)
128134
*/
129135
public function delete($id)
130136
{
131-
$result = $this->dispatchFromArray(
132-
'Darryldecode\Backend\Components\Navigation\Commands\DeleteCustomNavigationCommand',
133-
array(
134-
'id' => $id
135-
)
136-
);
137+
$result = $this->dispatch(new DeleteCustomNavigationCommand($id, true));
137138

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

src/Darryldecode/Backend/Components/User/Controllers/GroupController.php

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

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\User\Commands\QueryGroupsCommand;
1213
use Illuminate\Http\Request;
1314
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1415

@@ -42,15 +43,12 @@ public function __construct(Request $request, Response $response)
4243
*/
4344
public function index()
4445
{
45-
$results = $this->dispatchFromArray(
46-
'Darryldecode\Backend\Components\User\Commands\QueryGroupsCommand',
47-
array(
48-
'name' => $this->request->get('name',null),
49-
'with' => $this->request->get('with',array()),
50-
'paginate' => $this->request->get('paginate',null),
51-
'perPage' => $this->request->get('perPage',15),
52-
)
53-
);
46+
$results = $this->dispatch(new QueryGroupsCommand(
47+
$this->request->get('name',null),
48+
$this->request->get('with',array()),
49+
$this->request->get('paginate',null),
50+
$this->request->get('perPage',15)
51+
));
5452

5553
if( $this->request->ajax() )
5654
{

src/Darryldecode/Backend/Components/User/Controllers/UserController.php

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

1111
use Darryldecode\Backend\Base\Controllers\BaseController;
12+
use Darryldecode\Backend\Components\User\Commands\CreateUserCommand;
13+
use Darryldecode\Backend\Components\User\Commands\QueryUsersCommand;
14+
use Darryldecode\Backend\Components\User\Commands\UpdateUserCommand;
1215
use Illuminate\Http\Request;
1316
use Illuminate\Contracts\Routing\ResponseFactory as Response;
1417

@@ -42,20 +45,20 @@ public function __construct(Request $request, Response $response)
4245
*/
4346
public function index()
4447
{
45-
$result = $this->dispatchFromArray(
46-
'Darryldecode\Backend\Components\User\Commands\QueryUsersCommand',
47-
array(
48-
'firstName' => $this->request->get('firstName', null),
49-
'lastName' => $this->request->get('lastName', null),
50-
'email' => $this->request->get('email', null),
51-
'groupId' => $this->request->get('groupId', null),
52-
'orderBy' => $this->request->get('orderBy', 'created_at'),
53-
'orderSort' => $this->request->get('orderSort', 'DESC'),
54-
'paginated' => $this->request->get('paginated', true),
55-
'perPage' => $this->request->get('perPage', 15),
56-
'with' => $this->request->get('with', array()),
57-
)
58-
);
48+
$result = $this->dispatch(new QueryUsersCommand(
49+
null,
50+
$this->request->get('firstName', null),
51+
$this->request->get('lastName', null),
52+
$this->request->get('email', null),
53+
$this->request->get('groupId', null),
54+
$this->request->get('with', array()),
55+
$this->request->get('orderBy', 'created_at'),
56+
$this->request->get('orderSort', 'DESC'),
57+
$this->request->get('paginated', true),
58+
$this->request->get('perPage', 15),
59+
false,
60+
null
61+
));
5962

6063
if($this->request->ajax())
6164
{
@@ -79,17 +82,15 @@ public function index()
7982
*/
8083
public function postCreate()
8184
{
82-
$result = $this->dispatchFromArray(
83-
'Darryldecode\Backend\Components\User\Commands\CreateUserCommand',
84-
array(
85-
'firstName' => $this->request->get('firstName', null),
86-
'lastName' => $this->request->get('lastName', null),
87-
'email' => $this->request->get('email', null),
88-
'password' => $this->request->get('password', null),
89-
'permissions' => $this->request->get('permissions', array()),
90-
'groups' => $this->request->get('groups', array()),
91-
)
92-
);
85+
$result = $this->dispatch(new CreateUserCommand(
86+
$this->request->get('firstName', null),
87+
$this->request->get('lastName', null),
88+
$this->request->get('email', null),
89+
$this->request->get('password', null),
90+
$this->request->get('permissions', array()),
91+
$this->request->get('groups', array()),
92+
false
93+
));
9394

9495
return $this->response->json(array(
9596
'data' => $result->getData()->toArray(),
@@ -105,18 +106,16 @@ public function postCreate()
105106
*/
106107
public function putUpdate($userId)
107108
{
108-
$result = $this->dispatchFromArray(
109-
'Darryldecode\Backend\Components\User\Commands\UpdateUserCommand',
110-
array(
111-
'id' => $userId,
112-
'firstName' => $this->request->get('firstName', null),
113-
'lastName' => $this->request->get('lastName', null),
114-
'email' => $this->request->get('email', null),
115-
'password' => $this->request->get('password', null),
116-
'permissions' => $this->request->get('permissions', null),
117-
'groups' => $this->request->get('groups', null),
118-
)
119-
);
109+
$result = $this->dispatch(new UpdateUserCommand(
110+
$userId,
111+
$this->request->get('firstName', null),
112+
$this->request->get('lastName', null),
113+
$this->request->get('email', null),
114+
$this->request->get('password', null),
115+
$this->request->get('permissions', null),
116+
$this->request->get('groups', null),
117+
false
118+
));
120119

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

0 commit comments

Comments
 (0)