Commit c2eeb86b by Pancholin

validaciones blog

parent fe388bc4
......@@ -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(RequestEntry $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(RequestEntry $request, $id)
{
$post = Entry::find($id);
$post->fill($request->all());
......
......@@ -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(RequestCategory $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(RequestCategory $request, $id)
{
$category = Category::find($id);
$category->fill($request->all());
......
......@@ -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(RequestTags $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(RequestTags $request, $id)
{
$tag = TagCatalog::find($id);
$tag->fill($request->all());
......
<?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
<?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'
];
}
}
<?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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment