@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php namespace Taskforcedev\LaravelForum\Http\Controllers; |
2 | 2 | |
3 | 3 | use \Schema; |
4 | -use Taskforcedev\LaravelForum\Database\Migrator; |
|
5 | 4 | use Taskforcedev\LaravelForum\Forum; |
6 | 5 | use Taskforcedev\LaravelForum\ForumPost; |
7 | 6 | use Taskforcedev\LaravelForum\ForumReply; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $data = $this->buildData(); |
27 | 27 | |
28 | - $data['counts'] = [ |
|
28 | + $data[ 'counts' ] = [ |
|
29 | 29 | 'forum' => (new Forum)->getCount(), |
30 | 30 | 'category' => (new ForumCategory)->getCount(), |
31 | 31 | 'post' => (new ForumPost)->getCount(), |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | $data = $this->buildData(); |
48 | - $data['categories'] = ForumCategory::all(); |
|
49 | - $data['forums'] = Forum::orderBy('category_id')->get(); |
|
48 | + $data[ 'categories' ] = ForumCategory::all(); |
|
49 | + $data[ 'forums' ] = Forum::orderBy('category_id')->get(); |
|
50 | 50 | return view('laravel-forum::admin/forums', $data); |
51 | 51 | } |
52 | 52 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | $data = $this->buildData(); |
63 | - $data['categories'] = ForumCategory::all(); |
|
63 | + $data[ 'categories' ] = ForumCategory::all(); |
|
64 | 64 | return view('laravel-forum::admin/categories', $data); |
65 | 65 | } |
66 | 66 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $data = $this->buildData(); |
74 | - $data['categories'] = ForumCategory::all(); |
|
74 | + $data[ 'categories' ] = ForumCategory::all(); |
|
75 | 75 | return view('laravel-forum::admin.forum.create', $data); |
76 | 76 | } |
77 | 77 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function getCount() |
24 | 24 | { |
25 | - $count = \DB::select('select COUNT(*) as `count` from ' . $this->table); |
|
26 | - return $count[0]->count; |
|
25 | + $count = \DB::select('select COUNT(*) as `count` from '.$this->table); |
|
26 | + return $count[ 0 ]->count; |
|
27 | 27 | } |
28 | 28 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function migrateCategories() |
20 | 20 | { |
21 | 21 | if (!Schema::hasTable('forum_categories')) { |
22 | - Schema::create('forum_categories', function ($table) { |
|
22 | + Schema::create('forum_categories', function($table) { |
|
23 | 23 | $table->increments('id'); |
24 | 24 | $table->string('name'); |
25 | 25 | $table->timestamps(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function migrateForums() |
34 | 34 | { |
35 | 35 | if (!Schema::hasTable('forums')) { |
36 | - Schema::create('forums', function ($table) { |
|
36 | + Schema::create('forums', function($table) { |
|
37 | 37 | $table->increments('id'); |
38 | 38 | $table->string('name'); |
39 | 39 | $table->string('description')->nullable(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function migratePosts() |
51 | 51 | { |
52 | 52 | if (!Schema::hasTable('forum_posts')) { |
53 | - Schema::create('forum_posts', function ($table) { |
|
53 | + Schema::create('forum_posts', function($table) { |
|
54 | 54 | $table->increments('id'); |
55 | 55 | $table->string('title'); |
56 | 56 | $table->string('body', 4000); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function migrateReplies() |
68 | 68 | { |
69 | 69 | if (!Schema::hasTable('forum_post_replies')) { |
70 | - Schema::create('forum_post_replies', function ($table) { |
|
70 | + Schema::create('forum_post_replies', function($table) { |
|
71 | 71 | $table->increments('id'); |
72 | 72 | $table->string('body', 4000); |
73 | 73 | $table->integer('post_id')->unsigned(); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function addFieldsToForumPosts() |
84 | 84 | { |
85 | 85 | if (!Schema::hasColumn('forum_posts', 'sticky') && !Schema::hasColumn('forum_posts', 'locked')) { |
86 | - Schema::table('forum_posts', function ($table) { |
|
86 | + Schema::table('forum_posts', function($table) { |
|
87 | 87 | $table->boolean('sticky')->default(0); |
88 | 88 | $table->boolean('locked')->default(0); |
89 | 89 | }); |
@@ -24,6 +24,6 @@ |
||
24 | 24 | */ |
25 | 25 | public function broadcastOn() |
26 | 26 | { |
27 | - return ['laravel-forum']; |
|
27 | + return [ 'laravel-forum' ]; |
|
28 | 28 | } |
29 | 29 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | public $table = 'forums'; |
20 | 20 | |
21 | - public $fillable = ['name', 'description', 'category_id', 'public']; |
|
21 | + public $fillable = [ 'name', 'description', 'category_id', 'public' ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Eloquent Relation. |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | public function getThreadCount() |
46 | 46 | { |
47 | 47 | try { |
48 | - $result = DB::select('SELECT COUNT(*) as count FROM `forum_posts` where forum_id = ?', [$this->id]); |
|
49 | - return $result[0]->count; |
|
48 | + $result = DB::select('SELECT COUNT(*) as count FROM `forum_posts` where forum_id = ?', [ $this->id ]); |
|
49 | + return $result[ 0 ]->count; |
|
50 | 50 | } catch (\Exception $e) { |
51 | 51 | return 0; |
52 | 52 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | public $table = 'forum_categories'; |
16 | 16 | |
17 | - public $fillable = ['name']; |
|
17 | + public $fillable = [ 'name' ]; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Eloquent Relation. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public static function valid($data) |
34 | 34 | { |
35 | 35 | $rules = [ |
36 | - 'name' => ['required', 'min:3'], |
|
36 | + 'name' => [ 'required', 'min:3' ], |
|
37 | 37 | ]; |
38 | 38 | $validator = Validator::make($data, $rules); |
39 | 39 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | public $table = 'forum_posts'; |
23 | 23 | |
24 | - public $fillable = ['title', 'body', 'forum_id', 'author_id', 'sticky', 'locked']; |
|
24 | + public $fillable = [ 'title', 'body', 'forum_id', 'author_id', 'sticky', 'locked' ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Eloquent Relation. |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | { |
18 | 18 | protected $table = 'forum_post_replies'; |
19 | 19 | |
20 | - protected $hidden = []; |
|
21 | - protected $fillable = ['body', 'post_id', 'author_id']; |
|
20 | + protected $hidden = [ ]; |
|
21 | + protected $fillable = [ 'body', 'post_id', 'author_id' ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Eloquent Relation. |
@@ -59,6 +59,6 @@ discard block |
||
59 | 59 | public static function getReplyCount() |
60 | 60 | { |
61 | 61 | $results = DB::select('select COUNT(*) as count from forum_post_replies'); |
62 | - return $results[0]->count; |
|
62 | + return $results[ 0 ]->count; |
|
63 | 63 | } |
64 | 64 | } |
@@ -19,9 +19,9 @@ |
||
19 | 19 | |
20 | 20 | $script = $dom->getElementsByTagName('script'); |
21 | 21 | |
22 | - $remove = []; |
|
22 | + $remove = [ ]; |
|
23 | 23 | foreach ($script as $item) { |
24 | - $remove[] = $item; |
|
24 | + $remove[ ] = $item; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | foreach ($remove as $item) { |