@@ -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'),
|
@@ -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'),
|