@@ -54,6 +54,6 @@ |
||
54 | 54 | */ |
55 | 55 | public function routes() |
56 | 56 | { |
57 | - require __DIR__ . '/Http/routes.php'; |
|
57 | + require __DIR__.'/Http/routes.php'; |
|
58 | 58 | } |
59 | 59 | } |
@@ -6,28 +6,28 @@ |
||
6 | 6 | $widgets = [ |
7 | 7 | |
8 | 8 | 'forum' => [ |
9 | - 'count' => $counts['forum'], |
|
9 | + 'count' => $counts[ 'forum' ], |
|
10 | 10 | 'class' => 'bg-info', |
11 | 11 | 'title' => 'Forums', |
12 | 12 | 'size' => 2, |
13 | 13 | ], |
14 | 14 | |
15 | 15 | 'category' => [ |
16 | - 'count' => $counts['category'], |
|
16 | + 'count' => $counts[ 'category' ], |
|
17 | 17 | 'class' => 'bg-primary', |
18 | 18 | 'title' => 'Categories', |
19 | 19 | 'size' => 2, |
20 | 20 | ], |
21 | 21 | |
22 | 22 | 'post' => [ |
23 | - 'count' => $counts['post'], |
|
23 | + 'count' => $counts[ 'post' ], |
|
24 | 24 | 'class' => 'bg-success', |
25 | 25 | 'title' => 'Posts', |
26 | 26 | 'size' => 2, |
27 | 27 | ], |
28 | 28 | |
29 | 29 | 'reply' => [ |
30 | - 'count' => $counts['reply'], |
|
30 | + 'count' => $counts[ 'reply' ], |
|
31 | 31 | 'class' => 'bg-warning', |
32 | 32 | 'title' => 'Replies', |
33 | 33 | 'size' => 2, |
@@ -33,8 +33,8 @@ |
||
33 | 33 | $replyCount = count($post->replies); |
34 | 34 | $lastReply = $post->lastReply(); |
35 | 35 | if (isset($lastReply)) { |
36 | - $replyAuthor = $lastReply['author']; |
|
37 | - $replyDate = $lastReply['date']; |
|
36 | + $replyAuthor = $lastReply[ 'author' ]; |
|
37 | + $replyDate = $lastReply[ 'date' ]; |
|
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | <tr> |
@@ -2,20 +2,20 @@ |
||
2 | 2 | |
3 | 3 | @section('breadcrumbs') |
4 | 4 | <?php |
5 | - $postCounts = []; |
|
5 | + $postCounts = [ ]; |
|
6 | 6 | |
7 | 7 | /* Add Post Authors post count to postCounts array */ |
8 | - $postCounts[$post->author->id] = $userHelper->getPostCount($post->author->id); |
|
8 | + $postCounts[ $post->author->id ] = $userHelper->getPostCount($post->author->id); |
|
9 | 9 | |
10 | 10 | $forum = $post->forum; |
11 | 11 | $body = $sanitizer->sanitize($post->body); |
12 | 12 | $sticky = (bool)$post->sticky; |
13 | 13 | $locked = (bool)$post->locked; |
14 | 14 | if ($locked) { |
15 | - $title = 'Locked: ' . $post->title; |
|
15 | + $title = 'Locked: '.$post->title; |
|
16 | 16 | } else { |
17 | 17 | if ($sticky) { |
18 | - $title = 'Sticky: ' . $post->title; |
|
18 | + $title = 'Sticky: '.$post->title; |
|
19 | 19 | } else { |
20 | 20 | $title = $post->title; |
21 | 21 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | @endif |
36 | 36 | } |
37 | 37 | </script> |
38 | -<div class="modal fade" id="<?=$modal_id;?>" tabindex="-1" role="dialog" aria-hidden="true"> |
|
38 | +<div class="modal fade" id="<?=$modal_id; ?>" tabindex="-1" role="dialog" aria-hidden="true"> |
|
39 | 39 | <div class="modal-dialog"> |
40 | 40 | <div class="modal-content"> |
41 | 41 | <div class="modal-header"> |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | @if(in_array($f['type'], ['text', 'url', 'date', 'datetime', 'time', 'email', 'number'])) |
56 | 56 | <div class="input-group"> |
57 | 57 | <label class="label" for="{{ $f['name'] }}">{{ $f['label'] or ucfirst($f['name']) }}</label> |
58 | - <input class="form-control" id="{{ $f['name'] }}" <?php if(isset($f['value'])) { echo 'value="'. $f['value'] .'" '; } ?>type="{{ $f['type'] }}" placeholder="{{ $f['name'] }}" <?php if(isset($f['required']) && $f['required']) { echo 'required'; } ?> /> |
|
58 | + <input class="form-control" id="{{ $f['name'] }}" <?php if (isset($f[ 'value' ])) { echo 'value="'.$f[ 'value' ].'" '; } ?>type="{{ $f['type'] }}" placeholder="{{ $f['name'] }}" <?php if (isset($f[ 'required' ]) && $f[ 'required' ]) { echo 'required'; } ?> /> |
|
59 | 59 | </div> |
60 | 60 | @elseif(in_array($f['type'], ['select'])) |
61 | 61 | <div class="input-group"> |
62 | 62 | <label class="label" for="{{ $f['name'] }}">{{ $f['label'] or ucfirst($f['name']) }}</label> |
63 | 63 | <select id="{{ $f['name'] }}" class="form-control"> |
64 | - <?php $optionField = $f['field']; |
|
64 | + <?php $optionField = $f[ 'field' ]; |
|
65 | 65 | if (strpos($optionField, '.') !== false) { |
66 | 66 | $optionFields = explode('.', $optionField); |
67 | 67 | } |
@@ -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 | } |
@@ -29,28 +29,28 @@ |
||
29 | 29 | |
30 | 30 | Route::group(['namespace' => 'Taskforcedev\LaravelForum\Http\Controllers', 'middleware' => 'api'], function() { |
31 | 31 | |
32 | - Route::group(['prefix' => 'api'], function() { |
|
33 | - /* Forum Category */ |
|
34 | - Route::post('forum_category', [ 'as' => 'laravel-forum.api.store.category', 'uses' => 'ApiController@forumCategoryStore' ]); |
|
35 | - Route::delete('forum_category', [ 'as' => 'laravel-forum.api.delete.forum.category', 'uses' => 'ApiController@forumCategoryDelete' ]); |
|
36 | - |
|
37 | - /* Forum */ |
|
38 | - Route::post('forum', [ 'as' => 'laravel-forum.api.store.forum', 'uses' => 'ApiController@forumStore' ]); |
|
39 | - Route::delete('forum', [ 'as' => 'laravel-forum.api.delete.forum', 'uses' => 'ApiController@forumDelete' ]); |
|
40 | - |
|
41 | - /* Forum Post */ |
|
42 | - Route::post('forum_post', [ 'as' => 'laravel-forum.api.store.forum.post', 'uses' => 'ApiController@forumPostStore' ]); |
|
43 | - Route::delete('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.api.delete.forum.post', 'uses' => 'ApiController@postDelete' ]); |
|
44 | - /* Forum Post: Reply */ |
|
45 | - Route::post('forum_reply', [ 'as' => 'laravel-forum.api.store.forum.reply', 'uses' => 'ApiController@forumReplyStore' ]); |
|
46 | - |
|
47 | - /* Lock Forum Post */ |
|
48 | - Route::post('post/unlock/{id}', [ 'as' => 'laravel-forum.api.post.unlock', 'uses' => 'ApiController@unlockPost' ]); |
|
49 | - Route::post('post/lock/{id}', [ 'as' => 'laravel-forum.api.post.lock', 'uses' => 'ApiController@lockPost' ]); |
|
50 | - |
|
51 | - /* Sticky Forum Post */ |
|
52 | - Route::post('post/sticky/{id}', [ 'as' => 'laravel-forum.api.post.sticky', 'uses' => 'ApiController@stickyPost' ]); |
|
53 | - Route::post('post/unsticky/{id}', [ 'as' => 'laravel-forum.api.post.unsticky', 'uses' => 'ApiController@unstickyPost' ]); |
|
54 | - }); |
|
32 | + Route::group(['prefix' => 'api'], function() { |
|
33 | + /* Forum Category */ |
|
34 | + Route::post('forum_category', [ 'as' => 'laravel-forum.api.store.category', 'uses' => 'ApiController@forumCategoryStore' ]); |
|
35 | + Route::delete('forum_category', [ 'as' => 'laravel-forum.api.delete.forum.category', 'uses' => 'ApiController@forumCategoryDelete' ]); |
|
36 | + |
|
37 | + /* Forum */ |
|
38 | + Route::post('forum', [ 'as' => 'laravel-forum.api.store.forum', 'uses' => 'ApiController@forumStore' ]); |
|
39 | + Route::delete('forum', [ 'as' => 'laravel-forum.api.delete.forum', 'uses' => 'ApiController@forumDelete' ]); |
|
40 | + |
|
41 | + /* Forum Post */ |
|
42 | + Route::post('forum_post', [ 'as' => 'laravel-forum.api.store.forum.post', 'uses' => 'ApiController@forumPostStore' ]); |
|
43 | + Route::delete('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.api.delete.forum.post', 'uses' => 'ApiController@postDelete' ]); |
|
44 | + /* Forum Post: Reply */ |
|
45 | + Route::post('forum_reply', [ 'as' => 'laravel-forum.api.store.forum.reply', 'uses' => 'ApiController@forumReplyStore' ]); |
|
46 | + |
|
47 | + /* Lock Forum Post */ |
|
48 | + Route::post('post/unlock/{id}', [ 'as' => 'laravel-forum.api.post.unlock', 'uses' => 'ApiController@unlockPost' ]); |
|
49 | + Route::post('post/lock/{id}', [ 'as' => 'laravel-forum.api.post.lock', 'uses' => 'ApiController@lockPost' ]); |
|
50 | + |
|
51 | + /* Sticky Forum Post */ |
|
52 | + Route::post('post/sticky/{id}', [ 'as' => 'laravel-forum.api.post.sticky', 'uses' => 'ApiController@stickyPost' ]); |
|
53 | + Route::post('post/unsticky/{id}', [ 'as' => 'laravel-forum.api.post.unsticky', 'uses' => 'ApiController@unstickyPost' ]); |
|
54 | + }); |
|
55 | 55 | |
56 | 56 | }); |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -Route::group(['namespace' => 'Taskforcedev\LaravelForum\Http\Controllers', 'middleware' => 'web'], function() { |
|
3 | +Route::group([ 'namespace' => 'Taskforcedev\LaravelForum\Http\Controllers', 'middleware' => 'web' ], function() { |
|
4 | 4 | // Public Routes |
5 | - Route::get('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.view.post', 'uses' => 'ForumController@viewPost' ]); |
|
5 | + Route::get('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.view.post', 'uses' => 'ForumController@viewPost' ]); |
|
6 | 6 | |
7 | - Route::get('forum/{id}/post', [ 'as' => 'laravel-forum.write.post', 'uses' => 'ForumController@createPost' ]); |
|
8 | - Route::get('forum/{id}', [ 'as' => 'laravel-forum.view', 'uses' => 'ForumController@view' ]); |
|
9 | - Route::get('forum', [ 'as' => 'laravel-forum.index', 'uses' => 'ForumController@index' ]); |
|
7 | + Route::get('forum/{id}/post', [ 'as' => 'laravel-forum.write.post', 'uses' => 'ForumController@createPost' ]); |
|
8 | + Route::get('forum/{id}', [ 'as' => 'laravel-forum.view', 'uses' => 'ForumController@view' ]); |
|
9 | + Route::get('forum', [ 'as' => 'laravel-forum.index', 'uses' => 'ForumController@index' ]); |
|
10 | 10 | |
11 | 11 | // Admin Routes. |
12 | - Route::group(['prefix' => 'admin'], function() { |
|
13 | - Route::get('forums', [ 'as' => 'laravel-forum.admin.index', 'uses' => 'AdminController@index' ]); |
|
12 | + Route::group([ 'prefix' => 'admin' ], function() { |
|
13 | + Route::get('forums', [ 'as' => 'laravel-forum.admin.index', 'uses' => 'AdminController@index' ]); |
|
14 | 14 | |
15 | - Route::group(['prefix' => 'forums'], function() { |
|
15 | + Route::group([ 'prefix' => 'forums' ], function() { |
|
16 | 16 | /* Forums */ |
17 | - Route::get('forums', [ 'as' => 'laravel-forum.admin.forums', 'uses' => 'AdminController@forums' ]); |
|
18 | - Route::get('forums/create', ['as' => 'laravel-forum.admin.forum.create', 'uses' => 'AdminController@forumForm' ]); |
|
17 | + Route::get('forums', [ 'as' => 'laravel-forum.admin.forums', 'uses' => 'AdminController@forums' ]); |
|
18 | + Route::get('forums/create', [ 'as' => 'laravel-forum.admin.forum.create', 'uses' => 'AdminController@forumForm' ]); |
|
19 | 19 | |
20 | 20 | /* Categories */ |
21 | - Route::get('categories/create', ['as' => 'laravel-forum.admin.category.create', 'uses' => 'AdminController@categoryForm' ]); |
|
22 | - Route::get('categories', ['as' => 'laravel-forum.admin.categories', 'uses' => 'AdminController@categories']); |
|
21 | + Route::get('categories/create', [ 'as' => 'laravel-forum.admin.category.create', 'uses' => 'AdminController@categoryForm' ]); |
|
22 | + Route::get('categories', [ 'as' => 'laravel-forum.admin.categories', 'uses' => 'AdminController@categories' ]); |
|
23 | 23 | }); |
24 | 24 | |
25 | 25 | |
@@ -27,29 +27,29 @@ discard block |
||
27 | 27 | |
28 | 28 | }); |
29 | 29 | |
30 | -Route::group(['namespace' => 'Taskforcedev\LaravelForum\Http\Controllers', 'middleware' => ['web', 'api']], function() { |
|
30 | +Route::group([ 'namespace' => 'Taskforcedev\LaravelForum\Http\Controllers', 'middleware' => [ 'web', 'api' ] ], function() { |
|
31 | 31 | |
32 | - Route::group(['prefix' => 'api'], function() { |
|
32 | + Route::group([ 'prefix' => 'api' ], function() { |
|
33 | 33 | /* Forum Category */ |
34 | - Route::post('forum_category', [ 'as' => 'laravel-forum.api.store.category', 'uses' => 'ApiController@forumCategoryStore' ]); |
|
34 | + Route::post('forum_category', [ 'as' => 'laravel-forum.api.store.category', 'uses' => 'ApiController@forumCategoryStore' ]); |
|
35 | 35 | Route::delete('forum_category', [ 'as' => 'laravel-forum.api.delete.forum.category', 'uses' => 'ApiController@forumCategoryDelete' ]); |
36 | 36 | |
37 | 37 | /* Forum */ |
38 | - Route::post('forum', [ 'as' => 'laravel-forum.api.store.forum', 'uses' => 'ApiController@forumStore' ]); |
|
38 | + Route::post('forum', [ 'as' => 'laravel-forum.api.store.forum', 'uses' => 'ApiController@forumStore' ]); |
|
39 | 39 | Route::delete('forum', [ 'as' => 'laravel-forum.api.delete.forum', 'uses' => 'ApiController@forumDelete' ]); |
40 | 40 | |
41 | 41 | /* Forum Post */ |
42 | - Route::post('forum_post', [ 'as' => 'laravel-forum.api.store.forum.post', 'uses' => 'ApiController@forumPostStore' ]); |
|
43 | - Route::delete('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.api.delete.forum.post', 'uses' => 'ApiController@postDelete' ]); |
|
42 | + Route::post('forum_post', [ 'as' => 'laravel-forum.api.store.forum.post', 'uses' => 'ApiController@forumPostStore' ]); |
|
43 | + Route::delete('forum/{id}/post/{pid}', [ 'as' => 'laravel-forum.api.delete.forum.post', 'uses' => 'ApiController@postDelete' ]); |
|
44 | 44 | /* Forum Post: Reply */ |
45 | 45 | Route::post('forum_reply', [ 'as' => 'laravel-forum.api.store.forum.reply', 'uses' => 'ApiController@forumReplyStore' ]); |
46 | 46 | |
47 | 47 | /* Lock Forum Post */ |
48 | 48 | Route::post('post/unlock/{id}', [ 'as' => 'laravel-forum.api.post.unlock', 'uses' => 'ApiController@unlockPost' ]); |
49 | - Route::post('post/lock/{id}', [ 'as' => 'laravel-forum.api.post.lock', 'uses' => 'ApiController@lockPost' ]); |
|
49 | + Route::post('post/lock/{id}', [ 'as' => 'laravel-forum.api.post.lock', 'uses' => 'ApiController@lockPost' ]); |
|
50 | 50 | |
51 | 51 | /* Sticky Forum Post */ |
52 | - Route::post('post/sticky/{id}', [ 'as' => 'laravel-forum.api.post.sticky', 'uses' => 'ApiController@stickyPost' ]); |
|
52 | + Route::post('post/sticky/{id}', [ 'as' => 'laravel-forum.api.post.sticky', 'uses' => 'ApiController@stickyPost' ]); |
|
53 | 53 | Route::post('post/unsticky/{id}', [ 'as' => 'laravel-forum.api.post.unsticky', 'uses' => 'ApiController@unstickyPost' ]); |
54 | 54 | }); |
55 | 55 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | public function up() |
9 | 9 | { |
10 | 10 | if (!Schema::hasTable('forum_categories')) { |
11 | - Schema::create('forum_categories', function ($table) { |
|
11 | + Schema::create('forum_categories', function($table) { |
|
12 | 12 | $table->increments('id'); |
13 | 13 | $table->string('name'); |
14 | 14 | $table->timestamps(); |
@@ -14,8 +14,8 @@ |
||
14 | 14 | $table->string('body', 4000); |
15 | 15 | $table->integer('forum_id')->unsigned(); |
16 | 16 | $table->foreign('forum_id') |
17 | - ->references('id')->on('forums') |
|
18 | - ->onDelete('cascade'); |
|
17 | + ->references('id')->on('forums') |
|
18 | + ->onDelete('cascade'); |
|
19 | 19 | $table->integer('author_id'); |
20 | 20 | $table->timestamps(); |
21 | 21 | }); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | public function up() |
9 | 9 | { |
10 | 10 | if (!Schema::hasTable('forum_posts')) { |
11 | - Schema::create('forum_posts', function ($table) { |
|
11 | + Schema::create('forum_posts', function($table) { |
|
12 | 12 | $table->increments('id'); |
13 | 13 | $table->string('title'); |
14 | 14 | $table->string('body', 4000); |