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
b426c46a
Unverified
Commit
b426c46a
authored
Dec 01, 2017
by
Viral Solani
Committed by
GitHub
Dec 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #56 from viralsolani/analysis-zD6139
Apply fixes from StyleCI
parents
32d3c4b8
e9ad8276
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
26 deletions
+27
-26
PagesController.php
app/Http/Controllers/Backend/Pages/PagesController.php
+7
-7
PagesTableController.php
app/Http/Controllers/Backend/Pages/PagesTableController.php
+3
-3
Page.php
app/Models/Page/Page.php
+2
-2
PagesRepository.php
app/Repositories/Backend/Pages/PagesRepository.php
+11
-10
module.php
config/module.php
+4
-4
No files found.
app/Http/Controllers/Backend/Pages/PagesController.php
View file @
b426c46a
...
@@ -2,15 +2,15 @@
...
@@ -2,15 +2,15 @@
namespace
App\Http\Controllers\Backend\Pages
;
namespace
App\Http\Controllers\Backend\Pages
;
use
App\Models\Page\Page
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
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\CreatePageRequest
;
use
App\Http\Requests\Backend\Pages\DeletePageRequest
;
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\ManagePageRequest
;
use
App\Http\Requests\Backend\Pages\StorePageRequest
;
use
App\Http\Requests\Backend\Pages\UpdatePageRequest
;
use
App\Http\Requests\Backend\Pages\UpdatePageRequest
;
use
App\Models\Page\Page
;
use
App\Repositories\Backend\Pages\PagesRepository
;
/**
/**
* Class PagesController.
* Class PagesController.
...
@@ -63,7 +63,7 @@ class PagesController extends Controller
...
@@ -63,7 +63,7 @@ class PagesController extends Controller
}
}
/**
/**
* @param \App\Models\Page\Page $page
* @param \App\Models\Page\Page
$page
* @param \App\Http\Requests\Backend\Pages\EditPageRequest $request
* @param \App\Http\Requests\Backend\Pages\EditPageRequest $request
*
*
* @return mixed
* @return mixed
...
@@ -75,7 +75,7 @@ class PagesController extends Controller
...
@@ -75,7 +75,7 @@ class PagesController extends Controller
}
}
/**
/**
* @param \App\Models\Page\Page $page
* @param \App\Models\Page\Page
$page
* @param \App\Http\Requests\Backend\Pages\UpdatePageRequest $request
* @param \App\Http\Requests\Backend\Pages\UpdatePageRequest $request
*
*
* @return mixed
* @return mixed
...
@@ -88,7 +88,7 @@ class PagesController extends Controller
...
@@ -88,7 +88,7 @@ class PagesController extends Controller
}
}
/**
/**
* @param \App\Models\Page\Page $page
* @param \App\Models\Page\Page
$page
* @param \App\Http\Requests\Backend\Pages\DeletePageRequest $request
* @param \App\Http\Requests\Backend\Pages\DeletePageRequest $request
*
*
* @return mixed
* @return mixed
...
...
app/Http/Controllers/Backend/Pages/PagesTableController.php
View file @
b426c46a
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
namespace
App\Http\Controllers\Backend\Pages
;
namespace
App\Http\Controllers\Backend\Pages
;
use
Carbon\Carbon
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
Yajra\DataTables\Facades\DataTables
;
use
App\Repositories\Backend\Pages\PagesRepository
;
use
App\Http\Requests\Backend\Pages\ManagePageRequest
;
use
App\Http\Requests\Backend\Pages\ManagePageRequest
;
use
App\Repositories\Backend\Pages\PagesRepository
;
use
Carbon\Carbon
;
use
Yajra\DataTables\Facades\DataTables
;
/**
/**
* Class PagesTableController.
* Class PagesTableController.
...
...
app/Models/Page/Page.php
View file @
b426c46a
...
@@ -4,8 +4,8 @@ namespace App\Models\Page;
...
@@ -4,8 +4,8 @@ namespace App\Models\Page;
use
App\Models\BaseModel
;
use
App\Models\BaseModel
;
use
App\Models\ModelTrait
;
use
App\Models\ModelTrait
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
App\Models\Page\Traits\Attribute\PageAttribute
;
use
App\Models\Page\Traits\Attribute\PageAttribute
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
Page
extends
BaseModel
class
Page
extends
BaseModel
{
{
...
@@ -26,7 +26,7 @@ class Page extends BaseModel
...
@@ -26,7 +26,7 @@ class Page extends BaseModel
* The guarded field which are not mass assignable.
* The guarded field which are not mass assignable.
*
*
* @var array
* @var array
*/
*/
protected
$guarded
=
[
'id'
];
protected
$guarded
=
[
'id'
];
public
function
__construct
(
array
$attributes
=
[])
public
function
__construct
(
array
$attributes
=
[])
...
...
app/Repositories/Backend/Pages/PagesRepository.php
View file @
b426c46a
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
namespace
App\Repositories\Backend\Pages
;
namespace
App\Repositories\Backend\Pages
;
use
App\Models\Page\Page
;
use
App\Exceptions\GeneralException
;
use
App\Repositories\BaseRepository
;
use
App\Events\Backend\Pages\PageCreated
;
use
App\Events\Backend\Pages\PageCreated
;
use
App\Events\Backend\Pages\PageDeleted
;
use
App\Events\Backend\Pages\PageDeleted
;
use
App\Events\Backend\Pages\PageUpdated
;
use
App\Events\Backend\Pages\PageUpdated
;
use
App\Exceptions\GeneralException
;
use
App\Models\Page\Page
;
use
App\Repositories\BaseRepository
;
/**
/**
* Class PagesRepository.
* Class PagesRepository.
...
@@ -46,14 +46,15 @@ class PagesRepository extends BaseRepository
...
@@ -46,14 +46,15 @@ class PagesRepository extends BaseRepository
if
(
$this
->
query
()
->
where
(
'title'
,
$input
[
'title'
])
->
first
())
{
if
(
$this
->
query
()
->
where
(
'title'
,
$input
[
'title'
])
->
first
())
{
throw
new
GeneralException
(
trans
(
'exceptions.backend.pages.already_exists'
));
throw
new
GeneralException
(
trans
(
'exceptions.backend.pages.already_exists'
));
}
}
//Making extra fields
//Making extra fields
$input
[
'page_slug'
]
=
str_slug
(
$input
[
'title'
]);
$input
[
'page_slug'
]
=
str_slug
(
$input
[
'title'
]);
$input
[
'status'
]
=
isset
(
$input
[
'status'
])
?
1
:
0
;
$input
[
'status'
]
=
isset
(
$input
[
'status'
])
?
1
:
0
;
$input
[
'created_by'
]
=
access
()
->
user
()
->
id
;
$input
[
'created_by'
]
=
access
()
->
user
()
->
id
;
if
(
$page
=
Page
::
create
(
$input
)
)
{
if
(
$page
=
Page
::
create
(
$input
)
)
{
event
(
new
PageCreated
(
$page
));
event
(
new
PageCreated
(
$page
));
return
true
;
return
true
;
}
}
...
@@ -62,7 +63,7 @@ class PagesRepository extends BaseRepository
...
@@ -62,7 +63,7 @@ class PagesRepository extends BaseRepository
/**
/**
* @param \App\Models\Page\Page $page
* @param \App\Models\Page\Page $page
* @param
array
$input
* @param
array
$input
*
*
* @throws \App\Exceptions\GeneralException
* @throws \App\Exceptions\GeneralException
*
*
...
@@ -79,12 +80,12 @@ class PagesRepository extends BaseRepository
...
@@ -79,12 +80,12 @@ class PagesRepository extends BaseRepository
$input
[
'status'
]
=
isset
(
$input
[
'status'
])
?
1
:
0
;
$input
[
'status'
]
=
isset
(
$input
[
'status'
])
?
1
:
0
;
$input
[
'updated_by'
]
=
access
()
->
user
()
->
id
;
$input
[
'updated_by'
]
=
access
()
->
user
()
->
id
;
if
(
$page
->
update
(
$input
)
)
{
if
(
$page
->
update
(
$input
)
)
{
event
(
new
PageUpdated
(
$page
));
event
(
new
PageUpdated
(
$page
));
return
true
;
return
true
;
}
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.pages.update_error'
));
throw
new
GeneralException
(
trans
(
'exceptions.backend.pages.update_error'
));
}
}
...
@@ -97,7 +98,7 @@ class PagesRepository extends BaseRepository
...
@@ -97,7 +98,7 @@ class PagesRepository extends BaseRepository
*/
*/
public
function
delete
(
$page
)
public
function
delete
(
$page
)
{
{
if
(
$page
->
delete
()
)
{
if
(
$page
->
delete
()
)
{
event
(
new
PageDeleted
(
$page
));
event
(
new
PageDeleted
(
$page
));
return
true
;
return
true
;
...
...
config/module.php
View file @
b426c46a
<?php
<?php
return
[
return
[
'pages'
=>
[
'pages'
=>
[
'table'
=>
'pages'
'table'
=>
'pages'
,
]
],
];
];
\ No newline at end of file
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