33namespace App \Http \Controllers \Backend \Access \Permission ;
44
55use App \Http \Controllers \Controller ;
6+ use App \Http \Responses \ViewResponse ;
7+ use App \Http \Responses \RedirectResponse ;
8+ use App \Models \Access \Permission \Permission ;
9+ use App \Http \Responses \Backend \Access \Permission \EditResponse ;
10+ use App \Http \Responses \Backend \Access \Permission \CreateResponse ;
11+ use App \Repositories \Backend \Access \Permission \PermissionRepository ;
12+ use App \Http \Requests \Backend \Access \Permission \EditPermissionRequest ;
13+ use App \Http \Requests \Backend \Access \Permission \StorePermissionRequest ;
614use App \Http \Requests \Backend \Access \Permission \CreatePermissionRequest ;
715use App \Http \Requests \Backend \Access \Permission \DeletePermissionRequest ;
8- use App \Http \Requests \Backend \Access \Permission \EditPermissionRequest ;
916use App \Http \Requests \Backend \Access \Permission \ManagePermissionRequest ;
10- use App \Http \Requests \Backend \Access \Permission \StorePermissionRequest ;
1117use App \Http \Requests \Backend \Access \Permission \UpdatePermissionRequest ;
12- use App \Models \Access \Permission \Permission ;
13- use App \Repositories \Backend \Access \Permission \PermissionRepository ;
1418
1519/**
1620 * Class PermissionController.
@@ -33,71 +37,69 @@ public function __construct(PermissionRepository $permissions)
3337 /**
3438 * @param ManagePermissionRequest $request
3539 *
36- * @return mixed
40+ * @return \App\Http\Responses\ViewResponse
3741 */
3842 public function index (ManagePermissionRequest $ request )
3943 {
40- return view ('backend.access.permissions.index ' );
44+ return new ViewResponse ('backend.access.permissions.index ' );
4145 }
4246
4347 /**
4448 * @param CreatePermissionRequest $request
4549 *
46- * @return mixed
50+ * @return \App\Http\Responses\Backend\Access\Permission\CreateResponse
4751 */
4852 public function create (CreatePermissionRequest $ request )
4953 {
50- return view ('backend.access.permissions.create ' )
51- ->withPermissionCount ($ this ->permissions ->getCount ());
54+ return new CreateResponse ($ this ->permissions );
5255 }
5356
5457 /**
5558 * @param StorePermissionRequest $request
5659 *
57- * @return mixed
60+ * @return \App\Http\Responses\RedirectResponse
5861 */
5962 public function store (StorePermissionRequest $ request )
6063 {
6164 $ this ->permissions ->create ($ request ->all ());
6265
63- return redirect ()-> route ( 'admin.access.permission.index ' )-> withFlashSuccess ( trans ('alerts.backend.permissions.created ' ));
66+ return new RedirectResponse ( 'admin.access.permission.index ' , [ ' flash_success ' => trans ('alerts.backend.permissions.created ' )] );
6467 }
6568
6669 /**
6770 * @param Permission $permission
6871 * @param EditPermissionRequest $request
6972 *
70- * @return mixed
73+ * @return \App\Http\Responses\Backend\Access\Permission\EditResponse
7174 */
7275 public function edit (Permission $ permission , EditPermissionRequest $ request )
7376 {
74- return view ('backend.access.permissions.edit ' )
75- ->withPermission ($ permission );
77+ return new EditResponse ($ permission );
7678 }
7779
7880 /**
7981 * @param Permission $permission
8082 * @param UpdatePermissionRequest $request
8183 *
82- * @return mixed
84+ * @return \App\Http\Responses\RedirectResponse
8385 */
8486 public function update (Permission $ permission , UpdatePermissionRequest $ request )
8587 {
8688 $ this ->permissions ->update ($ permission , $ request ->all ());
8789
88- return redirect ()-> route ( 'admin.access.permission.index ' )-> withFlashSuccess ( trans ('alerts.backend.permissions.updated ' ));
90+ return new RedirectResponse ( 'admin.access.permission.index ' , [ ' flash_success ' => trans ('alerts.backend.permissions.updated ' )] );
8991 }
9092
9193 /**
9294 * @param Permission $permission
9395 * @param DeletePermissionRequest $request
9496 *
95- * @return mixed
97+ * @return \App\Http\Responses\RedirectResponse
9698 */
9799 public function destroy (Permission $ permission , DeletePermissionRequest $ request )
98100 {
99101 $ this ->permissions ->delete ($ permission );
100102
101- return redirect ()-> route ( 'admin.access.permission.index ' )-> withFlashSuccess ( trans ('alerts.backend.permissions.deleted ' ));
103+ return new RedirectResponse ( 'admin.access.permission.index ' , [ ' flash_success ' => trans ('alerts.backend.permissions.deleted ' )] );
102104 }
103105}
0 commit comments