Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-blog
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Angel Martin
onestartup-blog
Commits
c2eeb86b
Commit
c2eeb86b
authored
Jul 03, 2018
by
Pancholin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validaciones blog
parent
fe388bc4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
6 deletions
+112
-6
AdminBlogController.php
src/controllers/AdminBlogController.php
+4
-2
CategoryController.php
src/controllers/CategoryController.php
+4
-2
TagCatalogController.php
src/controllers/TagCatalogController.php
+3
-2
RequestCategory.php
src/requests/RequestCategory.php
+34
-0
RequestEntry.php
src/requests/RequestEntry.php
+36
-0
RequestTags.php
src/requests/RequestTags.php
+31
-0
No files found.
src/controllers/AdminBlogController.php
View file @
c2eeb86b
...
...
@@ -10,6 +10,8 @@ use Onestartup\Blog\Model\EntryCategory as Category;
use
Onestartup\Blog\Model\EntryTag
as
TagCatalog
;
use
Onestartup\Blog\Model\Entry
;
use
Onestartup\Blog\Model\CommentPost
;
use
Onestartup\Blog\Requests\RequestEntry
;
class
AdminBlogController
extends
Controller
{
...
...
@@ -40,7 +42,7 @@ class AdminBlogController extends Controller
* @param Request $request
* @return Response
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
Entry
$request
)
{
$post
=
new
Entry
(
$request
->
all
());
...
...
@@ -94,7 +96,7 @@ class AdminBlogController extends Controller
* @param Request $request
* @return Response
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
Entry
$request
,
$id
)
{
$post
=
Entry
::
find
(
$id
);
$post
->
fill
(
$request
->
all
());
...
...
src/controllers/CategoryController.php
View file @
c2eeb86b
...
...
@@ -9,6 +9,8 @@ use Yajra\Datatables\Datatables;
use
Onestartup\Blog\Model\EntryCategory
as
Category
;
use
Onestartup\Blog\Requests\RequestCategory
;
class
CategoryController
extends
Controller
{
/**
...
...
@@ -28,7 +30,7 @@ class CategoryController extends Controller
* @param Request $request
* @return Response
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
Category
$request
)
{
$category
=
new
Category
(
$request
->
all
());
...
...
@@ -67,7 +69,7 @@ class CategoryController extends Controller
* @param Request $request
* @return Response
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
Category
$request
,
$id
)
{
$category
=
Category
::
find
(
$id
);
$category
->
fill
(
$request
->
all
());
...
...
src/controllers/TagCatalogController.php
View file @
c2eeb86b
...
...
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
use
Yajra\Datatables\Datatables
;
use
Onestartup\Blog\Model\EntryTag
as
TagCatalog
;
use
Onestartup\Blog\Requests\RequestTags
;
class
TagCatalogController
extends
Controller
{
...
...
@@ -29,7 +30,7 @@ class TagCatalogController extends Controller
* @param Request $request
* @return Response
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
Tags
$request
)
{
$tag
=
new
TagCatalog
(
$request
->
all
());
$tag
->
save
();
...
...
@@ -56,7 +57,7 @@ class TagCatalogController extends Controller
* @param Request $request
* @return Response
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
Tags
$request
,
$id
)
{
$tag
=
TagCatalog
::
find
(
$id
);
$tag
->
fill
(
$request
->
all
());
...
...
src/requests/RequestCategory.php
0 → 100644
View file @
c2eeb86b
<?php
namespace
Onestartup\Blog\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
RequestCategory
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'name'
=>
'required|max:355'
,
'slug'
=>
'required|max:255'
,
'description'
=>
'max:455'
,
'active'
=>
'required'
];
}
}
\ No newline at end of file
src/requests/RequestEntry.php
0 → 100644
View file @
c2eeb86b
<?php
namespace
Onestartup\Blog\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
RequestEntry
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'title'
=>
'required|max:355'
,
'slug'
=>
'required|max:255'
,
'status'
=>
'required|numeric'
,
'tags'
=>
'required|max:800'
,
'publication_date'
=>
'required'
,
'category_id'
=>
'required'
,
'body'
=>
'required'
];
}
}
src/requests/RequestTags.php
0 → 100644
View file @
c2eeb86b
<?php
namespace
Onestartup\Blog\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
RequestTags
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public
function
rules
()
{
return
[
'description'
=>
'required|max:355'
,
];
}
}
\ 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