@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Create a new event instance. |
20 | 20 | * |
21 | - * @param $gameid |
|
21 | + * @param integer $gameid |
|
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | public function __construct($gameid) |
@@ -5,9 +5,7 @@ |
||
5 | 5 | use Illuminate\Broadcasting\Channel; |
6 | 6 | use Illuminate\Queue\SerializesModels; |
7 | 7 | use Illuminate\Broadcasting\PrivateChannel; |
8 | -use Illuminate\Broadcasting\PresenceChannel; |
|
9 | 8 | use Illuminate\Broadcasting\InteractsWithSockets; |
10 | -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; |
|
11 | 9 | |
12 | 10 | class GameView |
13 | 11 | { |
@@ -19,6 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Create a new event instance. |
21 | 21 | * |
22 | + * @param string $reason |
|
22 | 23 | * @return void |
23 | 24 | */ |
24 | 25 | public function __construct($reason, $user_id) |
@@ -5,9 +5,7 @@ |
||
5 | 5 | use Illuminate\Broadcasting\Channel; |
6 | 6 | use Illuminate\Queue\SerializesModels; |
7 | 7 | use Illuminate\Broadcasting\PrivateChannel; |
8 | -use Illuminate\Broadcasting\PresenceChannel; |
|
9 | 8 | use Illuminate\Broadcasting\InteractsWithSockets; |
10 | -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; |
|
11 | 9 | |
12 | 10 | class Obyx |
13 | 11 | { |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Exception; |
6 | 6 | use Illuminate\Auth\AuthenticationException; |
7 | 7 | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
8 | -use Intervention\Image\Exception\NotFoundException; |
|
9 | 8 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
10 | 9 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
11 | 10 |
@@ -47,9 +47,9 @@ |
||
47 | 47 | */ |
48 | 48 | public function render($request, Exception $exception) |
49 | 49 | { |
50 | - if($exception instanceof NotFoundHttpException){ |
|
50 | + if ($exception instanceof NotFoundHttpException) { |
|
51 | 51 | return response()->view('errors.404', [], 404); |
52 | - }elseif($exception instanceof AccessDeniedHttpException){ |
|
52 | + }elseif ($exception instanceof AccessDeniedHttpException) { |
|
53 | 53 | return response()->view('errors.403', [], 403); |
54 | 54 | } |
55 | 55 | return parent::render($request, $exception); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | if($exception instanceof NotFoundHttpException){ |
51 | 51 | return response()->view('errors.404', [], 404); |
52 | - }elseif($exception instanceof AccessDeniedHttpException){ |
|
52 | + } elseif($exception instanceof AccessDeniedHttpException){ |
|
53 | 53 | return response()->view('errors.403', [], 403); |
54 | 54 | } |
55 | 55 | return parent::render($request, $exception); |
@@ -80,6 +80,9 @@ |
||
80 | 80 | return $v->maxviews; |
81 | 81 | } |
82 | 82 | |
83 | + /** |
|
84 | + * @param string $type |
|
85 | + */ |
|
83 | 86 | public static function getCommentsMax($type){ |
84 | 87 | $v = \DB::table('comments') |
85 | 88 | ->selectRaw('count(id) as maxviews') |
@@ -7,41 +7,41 @@ discard block |
||
7 | 7 | use App\Models\GamesFile; |
8 | 8 | use Carbon\Carbon; |
9 | 9 | |
10 | -class DatabaseHelper{ |
|
10 | +class DatabaseHelper { |
|
11 | 11 | |
12 | - public static function getReleaseDateFromGameId($gameid){ |
|
12 | + public static function getReleaseDateFromGameId($gameid) { |
|
13 | 13 | $game = Game::whereId($gameid)->first(); |
14 | 14 | |
15 | - if(is_null($game)){ |
|
15 | + if (is_null($game)) { |
|
16 | 16 | return ''; |
17 | 17 | } |
18 | 18 | |
19 | - if(Carbon::parse($game->release_date)->year == -1 || is_null($game->release_date)){ |
|
19 | + if (Carbon::parse($game->release_date)->year == -1 || is_null($game->release_date)) { |
|
20 | 20 | $releasedate = GamesFile::whereGameId($gameid) |
21 | 21 | ->selectRaw('CONCAT(release_year, "-", LPAD(release_month, 2, "0"), "-", release_day) as reldate') |
22 | 22 | ->orderBy('release_type', 'desc') |
23 | 23 | ->orderBy('reldate', 'asc') |
24 | 24 | ->first(); |
25 | 25 | |
26 | - if($releasedate){ |
|
26 | + if ($releasedate) { |
|
27 | 27 | return Carbon::parse($releasedate->reldate)->toDateString(); |
28 | - }else{ |
|
28 | + }else { |
|
29 | 29 | return ''; |
30 | 30 | } |
31 | 31 | |
32 | - }else{ |
|
32 | + }else { |
|
33 | 33 | return Carbon::parse($game->release_date)->toDateString(); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - public static function getDevelopersUrlList($gameid){ |
|
37 | + public static function getDevelopersUrlList($gameid) { |
|
38 | 38 | $developers = \DB::table('games_developer') |
39 | 39 | ->leftJoin('developer', 'developer.id', '=', 'games_developer.developer_id') |
40 | 40 | ->where('games_developer.game_id', '=', $gameid) |
41 | 41 | ->get(); |
42 | 42 | |
43 | 43 | $res = ''; |
44 | - foreach ($developers as $dev){ |
|
44 | + foreach ($developers as $dev) { |
|
45 | 45 | $res = $res.'<a href="'.url('developer', $dev->id).'">'.$dev->name.'</a> :: '; |
46 | 46 | } |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | return $res; |
51 | 51 | } |
52 | 52 | |
53 | - public static function getResourcePathArray($id){ |
|
53 | + public static function getResourcePathArray($id) { |
|
54 | 54 | $resource = \DB::table('resources') |
55 | 55 | ->where('id', '=', $id) |
56 | 56 | ->first(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $res; |
65 | 65 | } |
66 | 66 | |
67 | - public static function getObyxPoints($reason){ |
|
67 | + public static function getObyxPoints($reason) { |
|
68 | 68 | $obyx = \DB::table('obyx') |
69 | 69 | ->where('reason', '=', $reason) |
70 | 70 | ->first(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return $obyx->value; |
73 | 73 | } |
74 | 74 | |
75 | - public static function getGameViewsMax(){ |
|
75 | + public static function getGameViewsMax() { |
|
76 | 76 | $v = \DB::table('games') |
77 | 77 | ->selectRaw('MAX(views) as maxviews') |
78 | 78 | ->first(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return $v->maxviews; |
81 | 81 | } |
82 | 82 | |
83 | - public static function getCommentsMax($type){ |
|
83 | + public static function getCommentsMax($type) { |
|
84 | 84 | $v = \DB::table('comments') |
85 | 85 | ->selectRaw('count(id) as maxviews') |
86 | 86 | ->where('content_type', '=', \DB::raw("'".$type."'")) |
@@ -89,35 +89,35 @@ discard block |
||
89 | 89 | return $v->maxviews; |
90 | 90 | } |
91 | 91 | |
92 | - public static function langId_from_short($short){ |
|
92 | + public static function langId_from_short($short) { |
|
93 | 93 | $lang = \DB::table('languages') |
94 | 94 | ->select('id') |
95 | 95 | ->where('short', '=', $short) |
96 | 96 | ->first(); |
97 | 97 | |
98 | - if($lang){ |
|
98 | + if ($lang) { |
|
99 | 99 | return $lang->id; |
100 | - }else{ |
|
100 | + }else { |
|
101 | 101 | return 0; |
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
105 | 105 | |
106 | - public static function developerId_from_developerName($developername){ |
|
106 | + public static function developerId_from_developerName($developername) { |
|
107 | 107 | $dev = \DB::table('developer') |
108 | 108 | ->select('id') |
109 | 109 | ->where('name', '=', $developername) |
110 | 110 | ->first(); |
111 | 111 | |
112 | - if($dev){ |
|
112 | + if ($dev) { |
|
113 | 113 | return $dev->id; |
114 | - }else{ |
|
114 | + }else { |
|
115 | 115 | return 0; |
116 | 116 | } |
117 | 117 | |
118 | 118 | } |
119 | 119 | |
120 | - public static function developer_add_and_get_developerId($developername){ |
|
120 | + public static function developer_add_and_get_developerId($developername) { |
|
121 | 121 | $d = new Developer; |
122 | 122 | $d->name = $developername; |
123 | 123 | $d->user_id = \Auth::id(); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | if($releasedate){ |
27 | 27 | return Carbon::parse($releasedate->reldate)->toDateString(); |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | return ''; |
30 | 30 | } |
31 | 31 | |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | return Carbon::parse($game->release_date)->toDateString(); |
34 | 34 | } |
35 | 35 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | if($lang){ |
99 | 99 | return $lang->id; |
100 | - }else{ |
|
100 | + } else{ |
|
101 | 101 | return 0; |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if($dev){ |
113 | 113 | return $dev->id; |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | return 0; |
116 | 116 | } |
117 | 117 |
@@ -36,6 +36,9 @@ |
||
36 | 36 | return $ret; |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param integer $size |
|
41 | + */ |
|
39 | 42 | public static function getReadableBytes($size){ |
40 | 43 | $bytes = $size; |
41 | 44 |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace App\Helpers; |
4 | 4 | |
5 | -class MiscHelper{ |
|
5 | +class MiscHelper { |
|
6 | 6 | |
7 | - public static function array_diff_assoc_recursive($array1, $array2){ |
|
8 | - $difference=array(); |
|
9 | - foreach($array1 as $key => $value) { |
|
10 | - if( is_array($value) ) { |
|
11 | - if( !isset($array2[$key]) || !is_array($array2[$key]) ) { |
|
7 | + public static function array_diff_assoc_recursive($array1, $array2) { |
|
8 | + $difference = array(); |
|
9 | + foreach ($array1 as $key => $value) { |
|
10 | + if (is_array($value)) { |
|
11 | + if (!isset($array2[$key]) || !is_array($array2[$key])) { |
|
12 | 12 | $difference[$key] = $value; |
13 | - } else { |
|
13 | + }else { |
|
14 | 14 | $new_diff = MiscHelper::array_diff_assoc_recursive($value, $array2[$key]); |
15 | - if( !empty($new_diff) ) |
|
15 | + if (!empty($new_diff)) |
|
16 | 16 | $difference[$key] = $new_diff; |
17 | 17 | } |
18 | - } else if( !array_key_exists($key,$array2) || $array2[$key] !== $value ) { |
|
18 | + }else if (!array_key_exists($key, $array2) || $array2[$key] !== $value) { |
|
19 | 19 | $difference[$key] = $value; |
20 | 20 | } |
21 | 21 | } |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | - public static function getPopularity($views, $max){ |
|
26 | + public static function getPopularity($views, $max) { |
|
27 | 27 | |
28 | 28 | $ret = 0; |
29 | 29 | |
30 | - if($max == 0 || $views == 0){ |
|
30 | + if ($max == 0 || $views == 0) { |
|
31 | 31 | $ret = 0; |
32 | - }else{ |
|
32 | + }else { |
|
33 | 33 | $ret = ($views / $max) * 100; |
34 | 34 | } |
35 | 35 | |
36 | 36 | return $ret; |
37 | 37 | } |
38 | 38 | |
39 | - public static function getReadableBytes($size){ |
|
39 | + public static function getReadableBytes($size) { |
|
40 | 40 | $bytes = $size; |
41 | 41 | |
42 | 42 | if ($bytes == 0) |
@@ -44,6 +44,6 @@ discard block |
||
44 | 44 | |
45 | 45 | $s = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'); |
46 | 46 | $e = floor(log($bytes, 1024)); |
47 | - return round($bytes/pow(1024, $e), 2).' '.$s[$e]; |
|
47 | + return round($bytes / pow(1024, $e), 2).' '.$s[$e]; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | $difference[$key] = $value; |
13 | 13 | } else { |
14 | 14 | $new_diff = MiscHelper::array_diff_assoc_recursive($value, $array2[$key]); |
15 | - if( !empty($new_diff) ) |
|
16 | - $difference[$key] = $new_diff; |
|
15 | + if( !empty($new_diff) ) { |
|
16 | + $difference[$key] = $new_diff; |
|
17 | + } |
|
17 | 18 | } |
18 | 19 | } else if( !array_key_exists($key,$array2) || $array2[$key] !== $value ) { |
19 | 20 | $difference[$key] = $value; |
@@ -29,7 +30,7 @@ discard block |
||
29 | 30 | |
30 | 31 | if($max == 0 || $views == 0){ |
31 | 32 | $ret = 0; |
32 | - }else{ |
|
33 | + } else{ |
|
33 | 34 | $ret = ($views / $max) * 100; |
34 | 35 | } |
35 | 36 | |
@@ -39,8 +40,9 @@ discard block |
||
39 | 40 | public static function getReadableBytes($size){ |
40 | 41 | $bytes = $size; |
41 | 42 | |
42 | - if ($bytes == 0) |
|
43 | - return "0.00 B"; |
|
43 | + if ($bytes == 0) { |
|
44 | + return "0.00 B"; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $s = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'); |
46 | 48 | $e = floor(log($bytes, 1024)); |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers\Api\v1; |
4 | 4 | |
5 | 5 | use App\Models\Game; |
6 | -use Carbon\Carbon; |
|
7 | -use Illuminate\Http\Request; |
|
8 | 6 | use App\Http\Controllers\Controller; |
9 | 7 | |
10 | 8 | class GameController extends Controller |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class GameController extends Controller |
11 | 11 | { |
12 | - public function index(){ |
|
12 | + public function index() { |
|
13 | 13 | return Game::select([ |
14 | 14 | 'id', |
15 | 15 | 'title', |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | ->get(); |
19 | 19 | } |
20 | 20 | |
21 | - public function show($id){ |
|
21 | + public function show($id) { |
|
22 | 22 | $game = Game::with('developers', 'user', 'maker', 'screenshots', 'comments')->whereId($id)->first(); |
23 | 23 | |
24 | 24 | return $game; |
25 | 25 | } |
26 | 26 | |
27 | - public function show_app(){ |
|
27 | + public function show_app() { |
|
28 | 28 | $games = Game::with('developers', 'user', 'maker', 'screenshots')->orderBy('created_at')->limit(25)->get(); |
29 | 29 | |
30 | 30 | $jason = [ |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers\Api\v1; |
4 | 4 | |
5 | 5 | use App\Models\GamesFile; |
6 | -use Illuminate\Http\Request; |
|
7 | 6 | use App\Http\Controllers\Controller; |
8 | 7 | |
9 | 8 | class TakoController extends Controller |
@@ -8,8 +8,8 @@ |
||
8 | 8 | |
9 | 9 | class TakoController extends Controller |
10 | 10 | { |
11 | - public function filelist(){ |
|
12 | - $list = GamesFile::with('gamefiletype', 'game')->get();//->take(5); |
|
11 | + public function filelist() { |
|
12 | + $list = GamesFile::with('gamefiletype', 'game')->get(); //->take(5); |
|
13 | 13 | |
14 | 14 | return $list; |
15 | 15 | } |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use App\Models\User; |
6 | -use Illuminate\Http\Request; |
|
7 | -use Illuminate\Support\Facades\Input; |
|
8 | 6 | use App\Models\Developer; |
9 | 7 | |
10 | 8 | class AutocompleteController extends Controller |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class AutocompleteController extends Controller |
11 | 11 | { |
12 | - public function developer($term){ |
|
12 | + public function developer($term) { |
|
13 | 13 | $result = array(); |
14 | 14 | |
15 | 15 | //$devs = Developer::whereName($term)->get(); |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | ->where('developer.name', 'like', '%'.$term.'%') |
19 | 19 | ->get(); |
20 | 20 | |
21 | - foreach ($devs as $dev){ |
|
21 | + foreach ($devs as $dev) { |
|
22 | 22 | $result[] = ['id' => $dev->id, 'value' => $dev->name]; |
23 | 23 | } |
24 | 24 | |
25 | 25 | return \Response::json($result); |
26 | 26 | } |
27 | 27 | |
28 | - public function game($term){ |
|
28 | + public function game($term) { |
|
29 | 29 | $result = array(); |
30 | 30 | |
31 | 31 | $games = \DB::table('games') |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | ->orWhere('subtitle', 'like', '%'.$term.'%') |
39 | 39 | ->get(); |
40 | 40 | |
41 | - foreach($games as $g){ |
|
42 | - if(is_null($g->subtitle) || $g->subtitle == ''){ |
|
41 | + foreach ($games as $g) { |
|
42 | + if (is_null($g->subtitle) || $g->subtitle == '') { |
|
43 | 43 | $result[] = ['id' => $g->id, 'value' => $g->title]; |
44 | - }else{ |
|
44 | + }else { |
|
45 | 45 | $result[] = ['id' => $g->id, 'value' => $g->title.' -=- '.$g->subtitle]; |
46 | 46 | } |
47 | 47 | |
@@ -50,28 +50,28 @@ discard block |
||
50 | 50 | return \Response::json($result); |
51 | 51 | } |
52 | 52 | |
53 | - public function faqcat($term){ |
|
53 | + public function faqcat($term) { |
|
54 | 54 | $result = array(); |
55 | 55 | |
56 | 56 | //$devs = Developer::whereName($term)->get(); |
57 | 57 | $devs = \DB::table('faq') |
58 | - ->select(['id','cat']) |
|
58 | + ->select(['id', 'cat']) |
|
59 | 59 | ->where('faq.cat', 'like', '%'.$term.'%') |
60 | 60 | ->groupBy('faq.cat') |
61 | 61 | ->get(); |
62 | 62 | |
63 | - foreach ($devs as $dev){ |
|
63 | + foreach ($devs as $dev) { |
|
64 | 64 | $result[] = ['id' => $dev->id, 'value' => $dev->cat]; |
65 | 65 | } |
66 | 66 | |
67 | 67 | return \Response::json($result); |
68 | 68 | } |
69 | 69 | |
70 | - public function awardpage($term){ |
|
70 | + public function awardpage($term) { |
|
71 | 71 | $result = array(); |
72 | 72 | $aw = \DB::table('award_pages')->get(); |
73 | 73 | |
74 | - foreach ($aw as $item){ |
|
74 | + foreach ($aw as $item) { |
|
75 | 75 | $result[] = [ |
76 | 76 | 'id' => $item->id, |
77 | 77 | 'value' => $item->title |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | return \Response::json($result); |
82 | 82 | } |
83 | 83 | |
84 | - public function awardcat($term){ |
|
84 | + public function awardcat($term) { |
|
85 | 85 | $result = array(); |
86 | 86 | $aw = \DB::table('award_cats')->get(); |
87 | 87 | |
88 | - foreach ($aw as $item){ |
|
88 | + foreach ($aw as $item) { |
|
89 | 89 | $result[] = [ |
90 | 90 | 'id' => $item->id, |
91 | 91 | 'value' => $item->title |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | return \Response::json($result); |
96 | 96 | } |
97 | 97 | |
98 | - public function awardsubcat($term){ |
|
98 | + public function awardsubcat($term) { |
|
99 | 99 | $result = array(); |
100 | 100 | $aw = \DB::table('award_subcats')->get(); |
101 | 101 | |
102 | - foreach ($aw as $item){ |
|
102 | + foreach ($aw as $item) { |
|
103 | 103 | $result[] = [ |
104 | 104 | 'id' => $item->id, |
105 | 105 | 'value' => $item->title |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | return \Response::json($result); |
110 | 110 | } |
111 | 111 | |
112 | - public function user($term){ |
|
112 | + public function user($term) { |
|
113 | 113 | $result = array(); |
114 | 114 | $users = User::where('name', 'like', '%'.$term.'%')->get(); |
115 | 115 | |
116 | - foreach ($users as $user){ |
|
116 | + foreach ($users as $user) { |
|
117 | 117 | $result[] = [ |
118 | 118 | 'id' => $user->id, |
119 | 119 | 'value' => $user->name, |
@@ -41,7 +41,7 @@ |
||
41 | 41 | foreach($games as $g){ |
42 | 42 | if(is_null($g->subtitle) || $g->subtitle == ''){ |
43 | 43 | $result[] = ['id' => $g->id, 'value' => $g->title]; |
44 | - }else{ |
|
44 | + } else{ |
|
45 | 45 | $result[] = ['id' => $g->id, 'value' => $g->title.' -=- '.$g->subtitle]; |
46 | 46 | } |
47 | 47 |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use App\Models\BoardThread; |
9 | 9 | use Carbon\Carbon; |
10 | 10 | use Illuminate\Http\Request; |
11 | -use Illuminate\Pagination\Paginator; |
|
12 | 11 | use Illuminate\Support\Facades\Input; |
13 | 12 | |
14 | 13 | class BoardController extends Controller |
@@ -86,7 +86,7 @@ |
||
86 | 86 | public function show_thread($threadid){ |
87 | 87 | $posts = BoardPost::with('user', 'thread', 'cat')->whereThreadId($threadid)->orderBy('id')->paginate(25); |
88 | 88 | if(!Input::get('page')){ |
89 | - return redirect('board/thread/'.$threadid.'?page='.$posts->lastPage()); |
|
89 | + return redirect('board/thread/'.$threadid.'?page='.$posts->lastPage()); |
|
90 | 90 | }else{ |
91 | 91 | return view('board.threads.show', [ |
92 | 92 | 'posts' => $posts, |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | class BoardController extends Controller |
15 | 15 | { |
16 | - public function index(){ |
|
16 | + public function index() { |
|
17 | 17 | $cats = BoardCat::with('last_user', 'threads')->orderBy('order')->get(); |
18 | 18 | |
19 | 19 | return view('board.index', [ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | ]); |
22 | 22 | } |
23 | 23 | |
24 | - public function show_cat($catid){ |
|
24 | + public function show_cat($catid) { |
|
25 | 25 | $thr = BoardThread::with('user', 'cat', 'last_user', 'posts') |
26 | 26 | ->whereCatId($catid) |
27 | 27 | ->orderBy('board_threads.pinned', 'desc') |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ]); |
35 | 35 | } |
36 | 36 | |
37 | - public function create_cat(){ |
|
37 | + public function create_cat() { |
|
38 | 38 | |
39 | 39 | $cats = \DB::table('board_cats') |
40 | 40 | ->select([ |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | ]); |
54 | 54 | } |
55 | 55 | |
56 | - public function order_cat($catid, $direction){ |
|
57 | - if($direction == 'up'){ |
|
56 | + public function order_cat($catid, $direction) { |
|
57 | + if ($direction == 'up') { |
|
58 | 58 | \DB::table('board_cats') |
59 | 59 | ->where('id', '=', $catid) |
60 | 60 | ->increment('order'); |
61 | - }else{ |
|
61 | + }else { |
|
62 | 62 | \DB::table('board_cats') |
63 | 63 | ->where('id', '=', $catid) |
64 | 64 | ->decrement('order'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return redirect()->action('BoardController@create_cat'); |
68 | 68 | } |
69 | 69 | |
70 | - public function store_cat(Request $request){ |
|
70 | + public function store_cat(Request $request) { |
|
71 | 71 | $this->validate($request, [ |
72 | 72 | 'name' => 'required', |
73 | 73 | 'desc' => 'required', |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return redirect()->action('BoardController@create_cat'); |
84 | 84 | } |
85 | 85 | |
86 | - public function show_thread($threadid){ |
|
86 | + public function show_thread($threadid) { |
|
87 | 87 | $posts = BoardPost::with('user', 'thread', 'cat')->whereThreadId($threadid)->orderBy('id')->paginate(25); |
88 | - if(!Input::get('page')){ |
|
88 | + if (!Input::get('page')) { |
|
89 | 89 | return redirect('board/thread/'.$threadid.'?page='.$posts->lastPage()); |
90 | - }else{ |
|
90 | + }else { |
|
91 | 91 | return view('board.threads.show', [ |
92 | 92 | 'posts' => $posts, |
93 | 93 | ]); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | - public function store_thread(Request $request){ |
|
99 | + public function store_thread(Request $request) { |
|
100 | 100 | $date = Carbon::now(); |
101 | 101 | |
102 | 102 | $threadid = \DB::table('board_threads')->insertGetId([ |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return redirect()->action('BoardController@show_thread', [$threadid]); |
125 | 125 | } |
126 | 126 | |
127 | - public function store_post(Request $request, $threadid){ |
|
127 | + public function store_post(Request $request, $threadid) { |
|
128 | 128 | $this->validate($request, [ |
129 | 129 | 'catid' => 'required', |
130 | 130 | 'message' => 'required', |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | return redirect()->to($url); |
163 | 163 | } |
164 | 164 | |
165 | - public function thread_close_switch($id, $state){ |
|
166 | - if(\Auth::check()){ |
|
167 | - if(\Auth::user()->can('mod-threads')){ |
|
168 | - if(is_numeric($id)){ |
|
169 | - if($state == 1 || $state == 0){ |
|
165 | + public function thread_close_switch($id, $state) { |
|
166 | + if (\Auth::check()) { |
|
167 | + if (\Auth::user()->can('mod-threads')) { |
|
168 | + if (is_numeric($id)) { |
|
169 | + if ($state == 1 || $state == 0) { |
|
170 | 170 | \DB::table('board_threads') |
171 | 171 | ->where('id', '=', $id) |
172 | 172 | ->update([ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return redirect()->action('BoardController@show_thread', $id); |
180 | 180 | } |
181 | 181 | |
182 | - public function post_edit($threadid, $postid){ |
|
182 | + public function post_edit($threadid, $postid) { |
|
183 | 183 | $post = BoardPost::whereId($postid)->first(); |
184 | 184 | |
185 | 185 | return view('board.post.edit', [ |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | ]); |
188 | 188 | } |
189 | 189 | |
190 | - public function post_update(Request $request, $threadid, $postid){ |
|
191 | - if(\Auth::check()){ |
|
190 | + public function post_update(Request $request, $threadid, $postid) { |
|
191 | + if (\Auth::check()) { |
|
192 | 192 | $this->validate($request, [ |
193 | 193 | 'thread_id' => 'required', |
194 | 194 | 'post_id' => 'required', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | \DB::table('board_cats') |
59 | 59 | ->where('id', '=', $catid) |
60 | 60 | ->increment('order'); |
61 | - }else{ |
|
61 | + } else{ |
|
62 | 62 | \DB::table('board_cats') |
63 | 63 | ->where('id', '=', $catid) |
64 | 64 | ->decrement('order'); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $posts = BoardPost::with('user', 'thread', 'cat')->whereThreadId($threadid)->orderBy('id')->paginate(25); |
88 | 88 | if(!Input::get('page')){ |
89 | 89 | return redirect('board/thread/'.$threadid.'?page='.$posts->lastPage()); |
90 | - }else{ |
|
90 | + } else{ |
|
91 | 91 | return view('board.threads.show', [ |
92 | 92 | 'posts' => $posts, |
93 | 93 | ]); |