@@ -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 | } |
@@ -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) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $post = ForumPost::create($data); |
83 | 83 | |
84 | 84 | event(new PostCreated($post, $user)); |
85 | - return redirect()->route('laravel-forum.view.post', [$forum_id , $post->id]); |
|
85 | + return redirect()->route('laravel-forum.view.post', [ $forum_id, $post->id ]); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function forumReplyStore() |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | ]; |
104 | 104 | |
105 | 105 | if (!ForumReply::valid($data)) { |
106 | - return redirect()->route('laravel-forum.view.post', [$forum_id, $post_id]); |
|
106 | + return redirect()->route('laravel-forum.view.post', [ $forum_id, $post_id ]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | $reply = ForumReply::create($data); |
110 | 110 | |
111 | 111 | event(new PostReply($reply, $user)); |
112 | - return redirect()->route('laravel-forum.view.post', [$forum_id, $post_id]); |
|
112 | + return redirect()->route('laravel-forum.view.post', [ $forum_id, $post_id ]); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | private function adminCheck() |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use \Schema; |
7 | 7 | |
8 | 8 | use Illuminate\Http\Request; |
9 | - |
|
10 | 9 | use Taskforcedev\LaravelForum\Forum; |
11 | 10 | use Taskforcedev\LaravelForum\ForumCategory; |
12 | 11 | use Taskforcedev\LaravelForum\ForumPost; |