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
addee78f
Commit
addee78f
authored
Jun 03, 2018
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Page Module Responsable Trait implementation complete
parent
65338fbd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
17 deletions
+72
-17
PagesController.php
app/Http/Controllers/Backend/Pages/PagesController.php
+19
-17
CreateResponse.php
app/Http/Responses/Backend/Page/CreateResponse.php
+20
-0
EditResponse.php
app/Http/Responses/Backend/Page/EditResponse.php
+33
-0
No files found.
app/Http/Controllers/Backend/Pages/PagesController.php
View file @
addee78f
...
...
@@ -2,15 +2,18 @@
namespace
App\Http\Controllers\Backend\Pages
;
use
App\Models\Page\Page
;
use
App\Http\Controllers\Controller
;
use
App\Http\Responses\ViewResponse
;
use
App\Http\Responses\RedirectResponse
;
use
App\Http\Responses\Backend\Page\EditResponse
;
use
App\Repositories\Backend\Pages\PagesRepository
;
use
App\Http\Requests\Backend\Pages\EditPageRequest
;
use
App\Http\Requests\Backend\Pages\StorePageRequest
;
use
App\Http\Requests\Backend\Pages\CreatePageRequest
;
use
App\Http\Requests\Backend\Pages\DeletePageRequest
;
use
App\Http\Requests\Backend\Pages\EditPageRequest
;
use
App\Http\Requests\Backend\Pages\ManagePageRequest
;
use
App\Http\Requests\Backend\Pages\StorePageRequest
;
use
App\Http\Requests\Backend\Pages\UpdatePageRequest
;
use
App\Models\Page\Page
;
use
App\Repositories\Backend\Pages\PagesRepository
;
/**
* Class PagesController.
...
...
@@ -30,70 +33,69 @@ class PagesController extends Controller
/**
* @param \App\Http\Requests\Backend\Pages\ManagePageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\ViewResponse
*/
public
function
index
(
ManagePageRequest
$request
)
{
return
view
(
'backend.pages.index'
);
return
new
ViewResponse
(
'backend.pages.index'
);
}
/**
* @param \App\Http\Requests\Backend\Pages\CreatePageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\ViewResponse
*/
public
function
create
(
CreatePageRequest
$request
)
{
return
view
(
'backend.pages.create'
);
return
new
ViewResponse
(
'backend.pages.create'
);
}
/**
* @param \App\Http\Requests\Backend\Pages\StorePageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
store
(
StorePageRequest
$request
)
{
$this
->
pages
->
create
(
$request
->
except
([
'_token'
]));
return
redirect
()
->
route
(
'admin.pages.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.pages.created'
)
);
return
new
RedirectResponse
(
'admin.pages.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.pages.created'
)]
);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\EditPageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\Backend\Page\EditResponse
*/
public
function
edit
(
Page
$page
,
EditPageRequest
$request
)
{
return
view
(
'backend.pages.edit'
)
->
withPage
(
$page
);
return
new
EditResponse
(
$page
);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\UpdatePageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
update
(
Page
$page
,
UpdatePageRequest
$request
)
{
$this
->
pages
->
update
(
$page
,
$request
->
except
([
'_method'
,
'_token'
]));
return
redirect
()
->
route
(
'admin.pages.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.pages.updated'
)
);
return
new
RedirectResponse
(
'admin.pages.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.pages.updated'
)]
);
}
/**
* @param \App\Models\Page\Page $page
* @param \App\Http\Requests\Backend\Pages\DeletePageRequest $request
*
* @return
mixed
* @return
\App\Http\Responses\RedirectResponse
*/
public
function
destroy
(
Page
$page
,
DeletePageRequest
$request
)
{
$this
->
pages
->
delete
(
$page
);
return
redirect
()
->
route
(
'admin.pages.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.pages.deleted'
)
);
return
new
RedirectResponse
(
'admin.pages.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.pages.deleted'
)]
);
}
}
app/Http/Responses/Backend/Page/CreateResponse.php
0 → 100644
View file @
addee78f
<?php
namespace
App\Http\Responses\Backend\Page
;
use
Illuminate\Contracts\Support\Responsable
;
class
CreateResponse
implements
Responsable
{
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
toResponse
(
$request
)
{
//
}
}
app/Http/Responses/Backend/Page/EditResponse.php
0 → 100644
View file @
addee78f
<?php
namespace
App\Http\Responses\Backend\Page
;
use
Illuminate\Contracts\Support\Responsable
;
class
EditResponse
implements
Responsable
{
/**
* @var \App\Models\Page\Page
*/
protected
$page
;
/**
* @param \App\Models\Page\Page $page
*/
public
function
__construct
(
$page
)
{
$this
->
page
=
$page
;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
toResponse
(
$request
)
{
return
view
(
'backend.pages.edit'
)
->
withPage
(
$this
->
page
);
}
}
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