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
f75b15d3
Commit
f75b15d3
authored
6 years ago
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified the Blogs Request on web and api to check for publish_datetime #250
Fixed style CI issues
parent
58da916d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
16 deletions
+43
-16
BlogsController.php
app/Http/Controllers/Api/V1/BlogsController.php
+8
-5
StoreBlogsRequest.php
app/Http/Requests/Backend/Blogs/StoreBlogsRequest.php
+6
-5
UpdateBlogsRequest.php
app/Http/Requests/Backend/Blogs/UpdateBlogsRequest.php
+5
-4
UpdateProfileRequest.php
app/Http/Requests/Frontend/User/UpdateProfileRequest.php
+1
-1
validation.php
resources/lang/en/validation.php
+1
-1
ManageBlogsTest.php
tests/Feature/Backend/ManageBlogsTest.php
+22
-0
No files found.
app/Http/Controllers/Api/V1/BlogsController.php
View file @
f75b15d3
...
...
@@ -121,12 +121,15 @@ class BlogsController extends APIController
{
$featured_image
=
(
$action
==
'insert'
)
?
'required'
:
''
;
$publish_datetime
=
$request
->
publish_datetime
!==
''
?
'required|date'
:
'required'
;
$validation
=
Validator
::
make
(
$request
->
all
(),
[
'name'
=>
'required|max:191'
,
'featured_image'
=>
$featured_image
,
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
'name'
=>
'required|max:191'
,
'featured_image'
=>
$featured_image
,
'publish_datetime'
=>
$publish_datetime
,
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
]);
return
$validation
;
...
...
This diff is collapsed.
Click to expand it.
app/Http/Requests/Backend/Blogs/StoreBlogsRequest.php
View file @
f75b15d3
...
...
@@ -27,11 +27,12 @@ class StoreBlogsRequest extends Request
public
function
rules
()
{
return
[
'name'
=>
'required|max:191'
,
'featured_image'
=>
'required'
,
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
'name'
=>
'required|max:191'
,
'featured_image'
=>
'required'
,
'publish_datetime'
=>
'required|date'
,
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
];
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Requests/Backend/Blogs/UpdateBlogsRequest.php
View file @
f75b15d3
...
...
@@ -27,10 +27,11 @@ class UpdateBlogsRequest extends Request
public
function
rules
()
{
return
[
'name'
=>
'required|max:191|unique:blogs,name,'
.
$this
->
segment
(
3
),
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
'name'
=>
'required|max:191|unique:blogs,name,'
.
$this
->
segment
(
3
),
'publish_datetime'
=>
'required|date'
,
'content'
=>
'required'
,
'categories'
=>
'required'
,
'tags'
=>
'required'
,
];
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Requests/Frontend/User/UpdateProfileRequest.php
View file @
f75b15d3
...
...
@@ -30,7 +30,7 @@ class UpdateProfileRequest extends Request
return
[
'first_name'
=>
'required|max:255'
,
'last_name'
=>
'required|max:255'
,
'email'
=>
[
'sometimes'
,
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)]
'email'
=>
[
'sometimes'
,
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)]
,
];
}
}
This diff is collapsed.
Click to expand it.
resources/lang/en/validation.php
View file @
f75b15d3
...
...
@@ -188,7 +188,7 @@ return [
'blogs'
=>
[
'title'
=>
'Blog Title'
,
'category'
=>
'Blog Category'
,
'publish'
=>
'Publi
c
h Date & Time'
,
'publish'
=>
'Publi
s
h Date & Time'
,
'image'
=>
'Featured Image'
,
'content'
=>
'Content'
,
'tags'
=>
'Tags'
,
...
...
This diff is collapsed.
Click to expand it.
tests/Feature/Backend/ManageBlogsTest.php
View file @
f75b15d3
...
...
@@ -100,6 +100,17 @@ class ManageBlogsTest extends TestCase
->
assertSessionHasErrors
(
'featured_image'
);
}
/** @test */
public
function
it_requires_publish_datetime_while_creating
()
{
$blog
=
$this
->
makeBlog
();
unset
(
$blog
->
publish_datetime
);
$this
->
post
(
route
(
'admin.blogs.store'
),
$blog
->
toArray
())
->
assertSessionHasErrors
(
'publish_datetime'
);
}
/** @test */
public
function
it_requires_categories_while_creating
()
{
...
...
@@ -156,6 +167,17 @@ class ManageBlogsTest extends TestCase
->
assertSessionHasErrors
(
'content'
);
}
/** @test */
public
function
it_requires_publish_datetime_while_updating
()
{
$this
->
withExceptionHandling
();
unset
(
$this
->
blog
->
publish_datetime
);
$this
->
patch
(
route
(
'admin.blogs.update'
,
$this
->
blog
),
$this
->
blog
->
toArray
())
->
assertSessionHasErrors
(
'publish_datetime'
);
}
/** @test */
public
function
it_requires_categories_while_updating
()
{
...
...
This diff is collapsed.
Click to expand it.
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