Unverified Commit 7d6c9fee authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #157 from viralsolani/analysis-XpleaW

Apply fixes from StyleCI
parents 82677a91 b87b272e
...@@ -29,9 +29,8 @@ class BlogTagsController extends APIController ...@@ -29,9 +29,8 @@ class BlogTagsController extends APIController
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
return BlogTagsResource::collection( return BlogTagsResource::collection(
$this->repository->getForDataTable()->paginate($limit) $this->repository->getForDataTable()->paginate($limit)
); );
...@@ -91,9 +90,8 @@ class BlogTagsController extends APIController ...@@ -91,9 +90,8 @@ class BlogTagsController extends APIController
public function validatingRequest(Request $request, $id = 0) public function validatingRequest(Request $request, $id = 0)
{ {
$validation = Validator::make($request->all(), [ $validation = Validator::make($request->all(), [
'name' => 'required|max:191|unique:blog_tags,name,'. $id, 'name' => 'required|max:191|unique:blog_tags,name,'.$id,
]); ]);
return $validation; return $validation;
......
...@@ -29,7 +29,6 @@ class BlogsController extends APIController ...@@ -29,7 +29,6 @@ class BlogsController extends APIController
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$limit = $request->get('paginate') ? $request->get('paginate') : 25; $limit = $request->get('paginate') ? $request->get('paginate') : 25;
return BlogsResource::collection( return BlogsResource::collection(
...@@ -89,10 +88,10 @@ class BlogsController extends APIController ...@@ -89,10 +88,10 @@ class BlogsController extends APIController
return new BlogsResource($blog); return new BlogsResource($blog);
} }
public function validatingRequest(Request $request, $type="insert") public function validatingRequest(Request $request, $type = 'insert')
{ {
$featured_image = ($type=="insert")?"required":""; $featured_image = ($type == 'insert') ? 'required' : '';
$validation = Validator::make($request->all(), [ $validation = Validator::make($request->all(), [
'name' => 'required|max:191', 'name' => 'required|max:191',
'featured_image' => $featured_image, 'featured_image' => $featured_image,
...@@ -103,6 +102,7 @@ class BlogsController extends APIController ...@@ -103,6 +102,7 @@ class BlogsController extends APIController
return $validation; return $validation;
} }
public function messages() public function messages()
{ {
return [ return [
...@@ -110,7 +110,7 @@ class BlogsController extends APIController ...@@ -110,7 +110,7 @@ class BlogsController extends APIController
'name.max' => 'Blog Title may not be greater than 191 characters.', 'name.max' => 'Blog Title may not be greater than 191 characters.',
]; ];
} }
/** /**
* @param Blog $blog * @param Blog $blog
* @param DeleteBlogRequest $request * @param DeleteBlogRequest $request
......
...@@ -15,11 +15,10 @@ class BlogTagsResource extends Resource ...@@ -15,11 +15,10 @@ class BlogTagsResource extends Resource
*/ */
public function toArray($request) public function toArray($request)
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
'status' => ($this->isActive()) ? "Active" : "InActive", 'status' => ($this->isActive()) ? 'Active' : 'InActive',
'created_at' => optional($this->created_at)->toDateString(), 'created_at' => optional($this->created_at)->toDateString(),
'created_by' => (isset($this->creator)) ? optional($this->creator)->first_name : $this->user_name, 'created_by' => (isset($this->creator)) ? optional($this->creator)->first_name : $this->user_name,
]; ];
......
...@@ -15,7 +15,6 @@ class BlogsResource extends Resource ...@@ -15,7 +15,6 @@ class BlogsResource extends Resource
*/ */
public function toArray($request) public function toArray($request)
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
......
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