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
a5d34fc4
Commit
a5d34fc4
authored
Mar 13, 2018
by
cygnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for blog tags refactoring
parent
283d472f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
34 deletions
+32
-34
BlogTagsController.php
app/Http/Controllers/Api/V1/BlogTagsController.php
+29
-31
BlogsController.php
app/Http/Controllers/Api/V1/BlogsController.php
+3
-3
No files found.
app/Http/Controllers/Api/V1/BlogTagsController.php
View file @
a5d34fc4
...
@@ -24,9 +24,9 @@ class BlogTagsController extends APIController
...
@@ -24,9 +24,9 @@ class BlogTagsController extends APIController
}
}
/**
/**
* Return the
user
s.
* Return the
BlogTag
s.
*
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\
Json
Response
*/
*/
public
function
index
(
Request
$request
)
public
function
index
(
Request
$request
)
{
{
...
@@ -40,9 +40,9 @@ class BlogTagsController extends APIController
...
@@ -40,9 +40,9 @@ class BlogTagsController extends APIController
/**
/**
* Return the specified resource.
* Return the specified resource.
*
*
* @param
User $user
* @param
BlogTag $blog_tag
*
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\
Json
Response
*/
*/
public
function
show
(
BlogTag
$blog_tag
)
public
function
show
(
BlogTag
$blog_tag
)
{
{
...
@@ -54,7 +54,7 @@ class BlogTagsController extends APIController
...
@@ -54,7 +54,7 @@ class BlogTagsController extends APIController
*
*
* @param Request $request
* @param Request $request
*
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\
Json
Response
*/
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
{
{
...
@@ -68,25 +68,13 @@ class BlogTagsController extends APIController
...
@@ -68,25 +68,13 @@ class BlogTagsController extends APIController
return
new
BlogTagsResource
(
BlogTag
::
orderBy
(
'created_at'
,
'desc'
)
->
first
());
return
new
BlogTagsResource
(
BlogTag
::
orderBy
(
'created_at'
,
'desc'
)
->
first
());
}
}
/** NOTE This function is same as about but uses StoreApiBlogTagsRequest for validation of the api
* Creates the Resource for BlogTag.
*
* @param Request $request
*
* @return \Illuminate\Http\Response
*/
// public function store(StoreApiBlogTagsRequest $request)
// {
// $this->repository->create($request->all());
// return new BlogTagsResource(BlogTag::orderBy('created_at', 'desc')->first());
// }
/**
/**
* Update BlogTag
*
* @param BlogTag $blog_tag
* @param BlogTag $blog_tag
* @param
UpdateBlogTagRequest
$request
* @param
Request
$request
*
*
* @return
mixed
* @return
\Illuminate\Http\JsonResponse
*/
*/
public
function
update
(
Request
$request
,
BlogTag
$blog_tag
)
public
function
update
(
Request
$request
,
BlogTag
$blog_tag
)
{
{
...
@@ -103,20 +91,13 @@ class BlogTagsController extends APIController
...
@@ -103,20 +91,13 @@ class BlogTagsController extends APIController
return
new
BlogTagsResource
(
$blog_tag
);
return
new
BlogTagsResource
(
$blog_tag
);
}
}
public
function
validatingRequest
(
Request
$request
,
$id
=
0
)
{
$validation
=
Validator
::
make
(
$request
->
all
(),
[
'name'
=>
'required|max:191|unique:blog_tags,name,'
.
$id
,
]);
return
$validation
;
}
/**
/**
* Delete BlogTag
*
* @param BlogTag $blog_tag
* @param BlogTag $blog_tag
* @param DeleteBlogTagRequest $request
* @param DeleteBlogTagRequest $request
*
*
* @return
mixed
* @return
\Illuminate\Http\JsonResponse
*/
*/
public
function
destroy
(
BlogTag
$blog_tag
,
Request
$request
)
public
function
destroy
(
BlogTag
$blog_tag
,
Request
$request
)
{
{
...
@@ -124,4 +105,21 @@ class BlogTagsController extends APIController
...
@@ -124,4 +105,21 @@ class BlogTagsController extends APIController
return
[
'message'
=>
'success'
];
return
[
'message'
=>
'success'
];
}
}
/**
* validate BlogTag.
*
* @param $request
*
* @return \Illuminate\Http\JsonResponse
*/
public
function
validatingRequest
(
Request
$request
,
$id
=
0
)
{
$validation
=
Validator
::
make
(
$request
->
all
(),
[
'name'
=>
'required|max:191|unique:blog_tags,name,'
.
$id
,
]);
return
$validation
;
}
}
}
app/Http/Controllers/Api/V1/BlogsController.php
View file @
a5d34fc4
...
@@ -115,9 +115,9 @@ class BlogsController extends APIController
...
@@ -115,9 +115,9 @@ class BlogsController extends APIController
*
*
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse
*/
*/
public
function
validateBlog
(
Request
$request
,
$
type
=
'insert'
)
public
function
validateBlog
(
Request
$request
,
$
action
=
'insert'
)
{
{
$featured_image
=
(
$
type
==
'insert'
)
?
'required'
:
''
;
$featured_image
=
(
$
action
==
'insert'
)
?
'required'
:
''
;
$validation
=
Validator
::
make
(
$request
->
all
(),
[
$validation
=
Validator
::
make
(
$request
->
all
(),
[
'name'
=>
'required|max:191'
,
'name'
=>
'required|max:191'
,
...
...
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