@@ -20,8 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct($model = null) |
| 22 | 22 | {
|
| 23 | - if (isset($model)) |
|
| 24 | - $this->model = $model; |
|
| 23 | + if (isset($model)) { |
|
| 24 | + $this->model = $model; |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | /** |
@@ -92,9 +92,10 @@ |
||
| 92 | 92 | |
| 93 | 93 | public function applySearch($repo, $terms, $fields) |
| 94 | 94 | {
|
| 95 | - foreach($terms as $term) |
|
| 96 | - foreach($fields as $field) |
|
| 97 | - $repo = $repo->orWhere($field, 'LIKE', '%' . $term . '%'); |
|
| 95 | + foreach($terms as $term) { |
|
| 96 | + foreach($fields as $field) |
|
| 97 | + $repo = $repo->orWhere($field, 'LIKE', '%' . $term . '%'); |
|
| 98 | + } |
|
| 98 | 99 | |
| 99 | 100 | foreach($repo as $data) |
| 100 | 101 | {
|
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct($model = null) |
| 22 | 22 | {
|
| 23 | - if (isset($model)) |
|
| 24 | - $this->model = $model; |
|
| 23 | + if (isset($model)) { |
|
| 24 | + $this->model = $model; |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | /** |
@@ -117,10 +117,11 @@ |
||
| 117 | 117 | */ |
| 118 | 118 | public function getCreatedByAttribute($value) |
| 119 | 119 | {
|
| 120 | - if ($value > 0) |
|
| 121 | - if ($user = Sentinel::findUserById($value)) |
|
| 120 | + if ($value > 0) { |
|
| 121 | + if ($user = Sentinel::findUserById($value)) |
|
| 122 | 122 | if ($user != null) |
| 123 | - return $user->first_name . ' ' . $user->last_name; |
|
| 123 | + return $user->first_name . ' ' . $user->last_name; |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | return $value; |
| 126 | 127 | } |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | ], 'routes'); |
| 66 | 66 | |
| 67 | 67 | // Include the routes file |
| 68 | - if(file_exists(base_path("app/Http/blog_routes.php"))) |
|
| 69 | - include base_path("app/Http/blog_routes.php"); |
|
| 68 | + if(file_exists(base_path("app/Http/blog_routes.php"))) { |
|
| 69 | + include base_path("app/Http/blog_routes.php"); |
|
| 70 | + } |
|
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | /** |
@@ -84,11 +85,13 @@ discard block |
||
| 84 | 85 | $users = array_get($baseConfig, 'models.User'); |
| 85 | 86 | $categories = array_get($config, 'models.BlogCategory'); |
| 86 | 87 | |
| 87 | - if (class_exists($model) && method_exists($model, 'setUsersModel')) |
|
| 88 | - forward_static_call_array([$model, 'setUsersModel'], [$users]); |
|
| 88 | + if (class_exists($model) && method_exists($model, 'setUsersModel')) { |
|
| 89 | + forward_static_call_array([$model, 'setUsersModel'], [$users]); |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | - if (class_exists($model) && method_exists($model, 'setCategoriesModel')) |
|
| 91 | - forward_static_call_array([$model, 'setCategoriesModel'], [$categories]); |
|
| 92 | + if (class_exists($model) && method_exists($model, 'setCategoriesModel')) { |
|
| 93 | + forward_static_call_array([$model, 'setCategoriesModel'], [$categories]); |
|
| 94 | + } |
|
| 92 | 95 | |
| 93 | 96 | return new BlogPostRepository($model); |
| 94 | 97 | }); |
@@ -107,8 +110,9 @@ discard block |
||
| 107 | 110 | $model = array_get($config, 'models.BlogCategory'); |
| 108 | 111 | $posts = array_get($config, 'models.BlogPost'); |
| 109 | 112 | |
| 110 | - if (class_exists($model) && method_exists($model, 'setPostsModel')) |
|
| 111 | - forward_static_call_array([$model, 'setPostsModel'], [$posts]); |
|
| 113 | + if (class_exists($model) && method_exists($model, 'setPostsModel')) { |
|
| 114 | + forward_static_call_array([$model, 'setPostsModel'], [$posts]); |
|
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | return new BlogCategoryRepository($model); |
| 114 | 118 | }); |
@@ -170,8 +170,9 @@ |
||
| 170 | 170 | |
| 171 | 171 | $cat = Blog::getCategoriesRepository()->findBySlug($slug); |
| 172 | 172 | |
| 173 | - if ($cat != null) |
|
| 174 | - return Redirect::route("categories")->with('error', Lang::get('blog.category.already_exists'));
|
|
| 173 | + if ($cat != null) { |
|
| 174 | + return Redirect::route("categories")->with('error', Lang::get('blog.category.already_exists')); |
|
| 175 | + } |
|
| 175 | 176 | |
| 176 | 177 | $cat = Blog::getCategoriesRepository()->create([ |
| 177 | 178 | 'name' => Input::get('name'),
|
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | /** |
| 151 | 151 | * Category create form processing. |
| 152 | 152 | * |
| 153 | - * @return Redirect |
|
| 153 | + * @return \Illuminate\Http\RedirectResponse |
|
| 154 | 154 | */ |
| 155 | 155 | public function postCreate() |
| 156 | 156 | {
|
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * Delete the given category. |
| 219 | 219 | * |
| 220 | 220 | * @param int $id |
| 221 | - * @return Redirect |
|
| 221 | + * @return \Illuminate\Http\RedirectResponse |
|
| 222 | 222 | */ |
| 223 | 223 | public function getDelete($id = null) |
| 224 | 224 | {
|
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * Restore a deleted category. |
| 265 | 265 | * |
| 266 | 266 | * @param int $id |
| 267 | - * @return Redirect |
|
| 267 | + * @return \Illuminate\Http\RedirectResponse |
|
| 268 | 268 | */ |
| 269 | 269 | public function getRestore($id = null) |
| 270 | 270 | {
|
@@ -80,11 +80,13 @@ discard block |
||
| 80 | 80 | $categories = Blog::getCategoriesRepository()->all(['id', 'name']); |
| 81 | 81 | $authors = Sentinel::createModel()->all(['id', 'first_name', 'last_name']); |
| 82 | 82 | |
| 83 | - foreach ($categories as $cat) |
|
| 84 | - $cats[$cat->id] = $cat->name; |
|
| 83 | + foreach ($categories as $cat) { |
|
| 84 | + $cats[$cat->id] = $cat->name; |
|
| 85 | + } |
|
| 85 | 86 | |
| 86 | - foreach ($authors as $author) |
|
| 87 | - $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 87 | + foreach ($authors as $author) { |
|
| 88 | + $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | // Show the page |
| 90 | 92 | return View('admin.posts.edit', compact('post', 'cats', 'users'));
|
@@ -165,11 +167,13 @@ discard block |
||
| 165 | 167 | $categories = Blog::getCategoriesRepository()->all(['id', 'name']); |
| 166 | 168 | $authors = Sentinel::createModel()->all(['id', 'first_name', 'last_name']); |
| 167 | 169 | |
| 168 | - foreach ($categories as $cat) |
|
| 169 | - $cats[$cat->id] = $cat->name; |
|
| 170 | + foreach ($categories as $cat) { |
|
| 171 | + $cats[$cat->id] = $cat->name; |
|
| 172 | + } |
|
| 170 | 173 | |
| 171 | - foreach ($authors as $author) |
|
| 172 | - $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 174 | + foreach ($authors as $author) { |
|
| 175 | + $users[$author->id] = $author->first_name . ' ' . $author->last_name; |
|
| 176 | + } |
|
| 173 | 177 | |
| 174 | 178 | // Show the page |
| 175 | 179 | return View('admin.posts.create', compact('cats', 'users'));
|
@@ -198,8 +202,9 @@ discard block |
||
| 198 | 202 | |
| 199 | 203 | $post = Blog::getPostsRepository()->findBySlug($slug); |
| 200 | 204 | |
| 201 | - if ($post != null) |
|
| 202 | - return Redirect::route("posts")->with('error', Lang::get('blog.posts.already_exists'));
|
|
| 205 | + if ($post != null) { |
|
| 206 | + return Redirect::route("posts")->with('error', Lang::get('blog.posts.already_exists')); |
|
| 207 | + } |
|
| 203 | 208 | |
| 204 | 209 | $post = Blog::getPostsRepository()->create([ |
| 205 | 210 | 'title' => Input::get('title'),
|
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Post update form processing page. |
| 95 | 95 | * |
| 96 | 96 | * @param int $id |
| 97 | - * @return Redirect |
|
| 97 | + * @return \Illuminate\Http\RedirectResponse |
|
| 98 | 98 | */ |
| 99 | 99 | public function postEdit($id = null) |
| 100 | 100 | {
|
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | /** |
| 179 | 179 | * Post create form processing. |
| 180 | 180 | * |
| 181 | - * @return Redirect |
|
| 181 | + * @return \Illuminate\Http\RedirectResponse |
|
| 182 | 182 | */ |
| 183 | 183 | public function postCreate() |
| 184 | 184 | {
|
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * Delete the given post. |
| 253 | 253 | * |
| 254 | 254 | * @param int $id |
| 255 | - * @return Redirect |
|
| 255 | + * @return \Illuminate\Http\RedirectResponse |
|
| 256 | 256 | */ |
| 257 | 257 | public function getDelete($id = null) |
| 258 | 258 | {
|
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * Restore a deleted post. |
| 299 | 299 | * |
| 300 | 300 | * @param int $id |
| 301 | - * @return Redirect |
|
| 301 | + * @return \Illuminate\Http\RedirectResponse |
|
| 302 | 302 | */ |
| 303 | 303 | public function getRestore($id = null) |
| 304 | 304 | {
|