Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
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
laravel-adminpanel
Commits
a5a0e4cd
Commit
a5a0e4cd
authored
Jun 03, 2018
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Permission Module Responses complete
parent
374d9bd1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
18 deletions
+87
-18
PermissionController.php
...ollers/Backend/Access/Permission/PermissionController.php
+20
-18
CreateResponse.php
...tp/Responses/Backend/Access/Permission/CreateResponse.php
+34
-0
EditResponse.php
...Http/Responses/Backend/Access/Permission/EditResponse.php
+33
-0
No files found.
app/Http/Controllers/Backend/Access/Permission/PermissionController.php
View file @
a5a0e4cd
...
...
@@ -3,14 +3,18 @@
namespace
App\Http\Controllers\Backend\Access\Permission
;
use
App\Http\Controllers\Controller
;
use
App\Http\Responses\ViewResponse
;
use
App\Http\Responses\RedirectResponse
;
use
App\Models\Access\Permission\Permission
;
use
App\Http\Responses\Backend\Access\Permission\EditResponse
;
use
App\Http\Responses\Backend\Access\Permission\CreateResponse
;
use
App\Repositories\Backend\Access\Permission\PermissionRepository
;
use
App\Http\Requests\Backend\Access\Permission\EditPermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\StorePermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\CreatePermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\DeletePermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\EditPermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\StorePermissionRequest
;
use
App\Http\Requests\Backend\Access\Permission\UpdatePermissionRequest
;
use
App\Models\Access\Permission\Permission
;
use
App\Repositories\Backend\Access\Permission\PermissionRepository
;
/**
* Class PermissionController.
...
...
@@ -33,71 +37,69 @@ class PermissionController extends Controller
/**
* @param ManagePermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\ViewResponse
*/
public
function
index
(
ManagePermissionRequest
$request
)
{
return
view
(
'backend.access.permissions.index'
);
return
new
ViewResponse
(
'backend.access.permissions.index'
);
}
/**
* @param CreatePermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\Backend\Access\Permission\CreateResponse
*/
public
function
create
(
CreatePermissionRequest
$request
)
{
return
view
(
'backend.access.permissions.create'
)
->
withPermissionCount
(
$this
->
permissions
->
getCount
());
return
new
CreateResponse
(
$this
->
permissions
);
}
/**
* @param StorePermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
store
(
StorePermissionRequest
$request
)
{
$this
->
permissions
->
create
(
$request
->
all
());
return
redirect
()
->
route
(
'admin.access.permission.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.permissions.created'
)
);
return
new
RedirectResponse
(
'admin.access.permission.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.permissions.created'
)]
);
}
/**
* @param Permission $permission
* @param EditPermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\Backend\Access\Permission\EditResponse
*/
public
function
edit
(
Permission
$permission
,
EditPermissionRequest
$request
)
{
return
view
(
'backend.access.permissions.edit'
)
->
withPermission
(
$permission
);
return
new
EditResponse
(
$permission
);
}
/**
* @param Permission $permission
* @param UpdatePermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
update
(
Permission
$permission
,
UpdatePermissionRequest
$request
)
{
$this
->
permissions
->
update
(
$permission
,
$request
->
all
());
return
redirect
()
->
route
(
'admin.access.permission.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.permissions.updated'
)
);
return
new
RedirectResponse
(
'admin.access.permission.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.permissions.updated'
)]
);
}
/**
* @param Permission $permission
* @param DeletePermissionRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
destroy
(
Permission
$permission
,
DeletePermissionRequest
$request
)
{
$this
->
permissions
->
delete
(
$permission
);
return
redirect
()
->
route
(
'admin.access.permission.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.permissions.deleted'
)
);
return
new
RedirectResponse
(
'admin.access.permission.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.permissions.deleted'
)]
);
}
}
app/Http/Responses/Backend/Access/
Role/Show
Response.php
→
app/Http/Responses/Backend/Access/
Permission/Create
Response.php
View file @
a5a0e4cd
<?php
namespace
App\Http\Responses\Backend\Access\
User
;
namespace
App\Http\Responses\Backend\Access\
Permission
;
use
Illuminate\Contracts\Support\Responsable
;
class
Show
Response
implements
Responsable
class
Create
Response
implements
Responsable
{
/**
* @var \App\
Models\Access\User\User
* @var \App\
Repositories\Backend\Access\Permission\PermissionRepository
*/
protected
$
user
;
protected
$
permissions
;
/**
* @param \App\
Models\Access\User\User $user
* @param \App\
Repositories\Backend\Access\Permission\PermissionRepository $permissions
*/
public
function
__construct
(
$
user
)
public
function
__construct
(
$
permissions
)
{
$this
->
user
=
$user
;
$this
->
permissions
=
$permissions
;
}
/**
...
...
@@ -28,6 +28,7 @@ class ShowResponse implements Responsable
*/
public
function
toResponse
(
$request
)
{
return
view
(
'backend.access.users.show'
)
->
withUser
(
$this
->
user
);
return
view
(
'backend.access.permissions.create'
)
->
withPermissionCount
(
$this
->
permissions
->
getCount
());
}
}
app/Http/Responses/Backend/Access/Permission/EditResponse.php
0 → 100644
View file @
a5a0e4cd
<?php
namespace
App\Http\Responses\Backend\Access\Permission
;
use
Illuminate\Contracts\Support\Responsable
;
class
EditResponse
implements
Responsable
{
/**
* @var \App\Models\Access\Permission\Permission
*/
protected
$permission
;
/**
* @param \App\Models\Access\Permission\Permission $permission
*/
public
function
__construct
(
$permission
)
{
$this
->
permission
=
$permission
;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
toResponse
(
$request
)
{
return
view
(
'backend.access.permissions.edit'
)
->
withPermission
(
$this
->
permission
);
}
}
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