Completed
Push — master ( 876046...6e04bc )
by Joao
02:55
created
src/Migrations/2016_01_15_123600_create_blog_tables.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function up()
14 14
     {
15 15
 
16
-        Schema::create('BlogCategory', function (Blueprint $table) {
16
+        Schema::create('BlogCategory', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('name', 100);
19 19
             $table->string('slug', 100);
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
             $table->creation();
25 25
         });
26 26
 
27
-        Schema::table('BlogCategory', function (Blueprint $table) {
27
+        Schema::table('BlogCategory', function(Blueprint $table) {
28 28
             $table->creationRelation();
29 29
         });
30 30
 
31
-        Schema::create('BlogPost', function (Blueprint $table) {
31
+        Schema::create('BlogPost', function(Blueprint $table) {
32 32
             $table->increments('id');
33 33
             $table->string('title', 100);
34 34
             $table->string('slug', 100);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             $table->foreign('author')->references('id')->on('User');
49 49
         });
50 50
 
51
-        Schema::table('BlogPost', function (Blueprint $table) {
51
+        Schema::table('BlogPost', function(Blueprint $table) {
52 52
             $table->creationRelation();
53 53
         });
54 54
 
Please login to merge, or discard this patch.
src/blogServiceProvider.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
         // Publish our views
41 41
         $this->loadViewsFrom(base_path("resources/views"), 'base');
42 42
         $this->publishes([
43
-            __DIR__ .  '/views' => base_path("resources/views")
43
+            __DIR__ . '/views' => base_path("resources/views")
44 44
         ]);
45 45
 
46 46
         // Publish our lang
47 47
         $this->publishes([
48
-            __DIR__ .  '/lang' => base_path("resources/lang")
48
+            __DIR__ . '/lang' => base_path("resources/lang")
49 49
         ], 'migrations');
50 50
 
51 51
         // Publish our migrations
52 52
         $this->publishes([
53
-            __DIR__ .  '/migrations' => base_path("database/migrations")
53
+            __DIR__ . '/migrations' => base_path("database/migrations")
54 54
         ], 'migrations');
55 55
 
56 56
         // Publish a config file
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         // Publish our routes
62 62
         $this->publishes([
63
-            __DIR__ .  '/routes.php' => base_path("app/Http/base_routes.php")
63
+            __DIR__ . '/routes.php' => base_path("app/Http/base_routes.php")
64 64
         ], 'routes');
65 65
     }
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function registerBlogPost()
73 73
     {
74
-        $this->app->singleton('jlourenco.blog.post', function ($app) {
74
+        $this->app->singleton('jlourenco.blog.post', function($app) {
75 75
             $baseConfig = $app['config']->get('jlourenco.base');
76 76
             $config = $app['config']->get('jlourenco.blog');
77 77
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function registerBlogCategory()
98 98
     {
99
-        $this->app->singleton('jlourenco.blog.category', function ($app) {
99
+        $this->app->singleton('jlourenco.blog.category', function($app) {
100 100
             $config = $app['config']->get('jlourenco.blog');
101 101
 
102 102
             $model = array_get($config, 'models.BlogCategory');
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     protected function registerBlog()
118 118
     {
119
-        $this->app->singleton('blog', function ($app) {
119
+        $this->app->singleton('blog', function($app) {
120 120
             $blog = new Blog($app['jlourenco.blog.post'], $app['jlourenco.blog.category']);
121 121
 
122 122
             return $blog;
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,11 +79,13 @@  discard block
 block discarded – undo
79 79
             $users = array_get($baseConfig, 'models.User');
80 80
             $categories = array_get($config, 'models.BlogCategory');
81 81
 
82
-            if (class_exists($model) && method_exists($model, 'setUsersModel'))
83
-                forward_static_call_array([$model, 'setUsersModel'], [$users]);
82
+            if (class_exists($model) && method_exists($model, 'setUsersModel')) {
83
+                            forward_static_call_array([$model, 'setUsersModel'], [$users]);
84
+            }
84 85
 
85
-            if (class_exists($model) && method_exists($model, 'setCategoriesModel'))
86
-                forward_static_call_array([$model, 'setCategoriesModel'], [$categories]);
86
+            if (class_exists($model) && method_exists($model, 'setCategoriesModel')) {
87
+                            forward_static_call_array([$model, 'setCategoriesModel'], [$categories]);
88
+            }
87 89
 
88 90
             return new BlogPostRepository($model);
89 91
         });
@@ -102,8 +104,9 @@  discard block
 block discarded – undo
102 104
             $model = array_get($config, 'models.BlogCategory');
103 105
             $posts = array_get($config, 'models.BlogPost');
104 106
 
105
-            if (class_exists($model) && method_exists($model, 'setPostsModel'))
106
-                forward_static_call_array([$model, 'setPostsModel'], [$posts]);
107
+            if (class_exists($model) && method_exists($model, 'setPostsModel')) {
108
+                            forward_static_call_array([$model, 'setPostsModel'], [$posts]);
109
+            }
107 110
 
108 111
             return new BlogCategoryRepository($model);
109 112
         });
Please login to merge, or discard this patch.
src/Repositories/BlogPostRepository.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Repositories/BlogCategoryRepository.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * All the "restricted area" routes
6 6
  * are defined here.
7 7
  */
8
-Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function ()
8
+Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function()
9 9
 {
10 10
 
11 11
     # Blog pages
Please login to merge, or discard this patch.
src/Controllers/BlogController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function update($id, Request $request)
35 35
     {
36
-        $this->validate($request, [ 'value' => 'required' ]);
36
+        $this->validate($request, ['value' => 'required']);
37 37
 
38 38
         $move = Blog::getPostsRepository()->findOrFail($id);
39 39
 
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
         $categories = $this->applySearch(Blog::getCategoriesRepository(), $terms, ['name', 'description'])->select('name as a', DB::raw('\'Category\' AS type'))->distinct()->get()->toArray();
88 88
 
89 89
         // Returning the results
90
-        return response()->json( [ 'data' => array_merge($users, $categories, $posts) ] );
90
+        return response()->json(['data' => array_merge($users, $categories, $posts)]);
91 91
     }
92 92
 
93 93
     public function applySearch($repo, $terms, $fields)
94 94
     {
95
-        foreach($terms as $term)
96
-            foreach($fields as $field)
95
+        foreach ($terms as $term)
96
+            foreach ($fields as $field)
97 97
                 $repo = $repo->orWhere($field, 'LIKE', '%' . $term . '%');
98 98
 
99
-        foreach($repo as $data)
99
+        foreach ($repo as $data)
100 100
         {
101 101
             dd($repo);
102 102
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,9 +92,10 @@
 block discarded – undo
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
         {
Please login to merge, or discard this patch.