@@ -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)); |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | * Store a newly created resource in storage. |
| 82 | 82 | * |
| 83 | 83 | * @param \Illuminate\Http\Request $request |
| 84 | - * @return \Illuminate\Http\Response |
|
| 84 | + * @return \Illuminate\Http\RedirectResponse |
|
| 85 | 85 | */ |
| 86 | 86 | public function store(Request $request) |
| 87 | 87 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | ->leftJoin('games_developer', 'games.id', '=', 'games_developer.game_id') |
| 21 | 21 | ->leftJoin('developer', 'games_developer.developer_id', '=', 'developer.id') |
| 22 | 22 | ->leftJoin('makers', 'makers.id', '=', 'games.maker_id') |
| 23 | - ->leftJoin('comments', function($join){ |
|
| 23 | + ->leftJoin('comments', function($join) { |
|
| 24 | 24 | $join->on('comments.content_id', '=', 'games.id'); |
| 25 | 25 | $join->on('comments.content_type', '=', \DB::raw("'game'")); |
| 26 | 26 | }) |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | ->select('id', 'title', 'short') |
| 56 | 56 | ->get(); |
| 57 | 57 | $gtypes = array(); |
| 58 | - foreach ($gametypes as $gt){ |
|
| 58 | + foreach ($gametypes as $gt) { |
|
| 59 | 59 | $t['title'] = $gt->title; |
| 60 | 60 | $t['short'] = $gt->short; |
| 61 | 61 | $gtypes[$gt->id] = $t; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - return view('cdc.index',[ |
|
| 64 | + return view('cdc.index', [ |
|
| 65 | 65 | 'cdcs' => $cdc, |
| 66 | 66 | 'gametypes' => $gtypes, |
| 67 | 67 | ]); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | ]); |
| 91 | 91 | |
| 92 | 92 | // Prüfen ob das Spiel auch wirklich existiert |
| 93 | - $title = explode(" -=- ",$request->get('gamename')); |
|
| 93 | + $title = explode(" -=- ", $request->get('gamename')); |
|
| 94 | 94 | |
| 95 | - if(count($title) == 1){ |
|
| 95 | + if (count($title) == 1) { |
|
| 96 | 96 | $game = Game::whereTitle($title[0]) |
| 97 | 97 | ->first(); |
| 98 | - }else{ |
|
| 98 | + }else { |
|
| 99 | 99 | $game = Game::whereTitle($title[0]) |
| 100 | 100 | ->orWhere('subtitle', '=', $title[1]) |
| 101 | 101 | ->first(); |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | if(count($title) == 1){ |
| 96 | 96 | $game = Game::whereTitle($title[0]) |
| 97 | 97 | ->first(); |
| 98 | - }else{ |
|
| 98 | + } else{ |
|
| 99 | 99 | $game = Game::whereTitle($title[0]) |
| 100 | 100 | ->orWhere('subtitle', '=', $title[1]) |
| 101 | 101 | ->first(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * Store a newly created resource in storage. |
| 72 | 72 | * |
| 73 | 73 | * @param \Illuminate\Http\Request $request |
| 74 | - * @return \Illuminate\Http\Response |
|
| 74 | + * @return \Illuminate\Http\RedirectResponse |
|
| 75 | 75 | */ |
| 76 | 76 | public function store(Request $request) |
| 77 | 77 | { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @param \Illuminate\Http\Request $request |
| 240 | 240 | * @param int $id |
| 241 | - * @return \Illuminate\Http\Response |
|
| 241 | + * @return \Illuminate\Http\RedirectResponse |
|
| 242 | 242 | */ |
| 243 | 243 | public function update(Request $request, $id) |
| 244 | 244 | { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * Remove the specified resource from storage. |
| 265 | 265 | * |
| 266 | 266 | * @param int $id |
| 267 | - * @return \Illuminate\Http\Response |
|
| 267 | + * @return \Illuminate\Http\RedirectResponse |
|
| 268 | 268 | */ |
| 269 | 269 | public function destroy($id) |
| 270 | 270 | { |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function index($orderby = 'title', $direction = 'asc') |
| 28 | 28 | { |
| 29 | - if($orderby == 'developer.name') { |
|
| 29 | + if ($orderby == 'developer.name') { |
|
| 30 | 30 | $games = Game::Join('games_developer', 'games.id', '=', 'games_developer.game_id') |
| 31 | 31 | ->Join('developer', 'games_developer.developer_id', '=', 'developer.id') |
| 32 | 32 | ->orderBy($orderby, $direction)->select('games.*')->paginate(20); |
| 33 | - }elseif($orderby == 'game.release_date'){ |
|
| 33 | + }elseif ($orderby == 'game.release_date') { |
|
| 34 | 34 | $games = Game::Join('games_files', 'games.id', '=', 'games_files.game_id') |
| 35 | 35 | ->orderBy('games_files.release_year', $direction) |
| 36 | 36 | ->orderBy('games_files.release_month', $direction) |
| 37 | 37 | ->orderBy('games_files.release_day', $direction) |
| 38 | 38 | ->select('games.*') |
| 39 | 39 | ->paginate(20); |
| 40 | - }else{ |
|
| 41 | - $games = Game::orderBy($orderby,$direction)->orderBy('title')->orderBy('subtitle')->paginate(20); |
|
| 40 | + }else { |
|
| 41 | + $games = Game::orderBy($orderby, $direction)->orderBy('title')->orderBy('subtitle')->paginate(20); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return view('games.index', [ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $g = new Game; |
| 94 | 94 | $g->title = $request->get('title'); |
| 95 | - $g->subtitle = $request->get('subtitle', ''); |
|
| 95 | + $g->subtitle = $request->get('subtitle', ''); |
|
| 96 | 96 | $g->desc_md = $request->get('desc'); |
| 97 | 97 | $g->desc_html = \Markdown::convertToHtml($request->get('desc')); |
| 98 | 98 | $g->website_url = $request->get('websiteurl', ''); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param $id |
| 123 | 123 | * @return \Illuminate\Http\RedirectResponse |
| 124 | 124 | */ |
| 125 | - public function store_developer(Request $request, $id){ |
|
| 125 | + public function store_developer(Request $request, $id) { |
|
| 126 | 126 | $this->validate($request, [ |
| 127 | 127 | 'developer' => 'required', |
| 128 | 128 | ]); |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function destroy($id) |
| 270 | 270 | { |
| 271 | - $validate = Input::get('confirm',''); |
|
| 272 | - if(\Auth::check()){ |
|
| 273 | - if(\Auth::user()->can('delete-games')){ |
|
| 274 | - if($validate == 'CONFIRM+'.$id){ |
|
| 271 | + $validate = Input::get('confirm', ''); |
|
| 272 | + if (\Auth::check()) { |
|
| 273 | + if (\Auth::user()->can('delete-games')) { |
|
| 274 | + if ($validate == 'CONFIRM+'.$id) { |
|
| 275 | 275 | Game::whereId($id)->delete(); |
| 276 | 276 | GamesFile::whereGameId($id)->delete(); |
| 277 | 277 | Screenshot::whereGameId($id)->delete(); |
| 278 | 278 | GamesDeveloper::whereGameId($id)->delete(); |
| 279 | 279 | Comment::whereContentId($id)->where('content_type', '=', 'game')->delete(); |
| 280 | 280 | TagRelation::whereContentId($id)->where('content_type', '=', 'game')->delete(); |
| 281 | - }else{ |
|
| 281 | + }else { |
|
| 282 | 282 | return redirect()->action('GameController@edit', $id); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | return redirect()->route('home'); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - public function destroy_developer(Request $request, $id){ |
|
| 291 | + public function destroy_developer(Request $request, $id) { |
|
| 292 | 292 | \DB::table('games_developer') |
| 293 | 293 | ->where('game_id', '=', $id) |
| 294 | 294 | ->where('developer_id', '=', $request->get('devid')) |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $games = Game::Join('games_developer', 'games.id', '=', 'games_developer.game_id') |
| 31 | 31 | ->Join('developer', 'games_developer.developer_id', '=', 'developer.id') |
| 32 | 32 | ->orderBy($orderby, $direction)->select('games.*')->paginate(20); |
| 33 | - }elseif($orderby == 'game.release_date'){ |
|
| 33 | + } elseif($orderby == 'game.release_date'){ |
|
| 34 | 34 | $games = Game::Join('games_files', 'games.id', '=', 'games_files.game_id') |
| 35 | 35 | ->orderBy('games_files.release_year', $direction) |
| 36 | 36 | ->orderBy('games_files.release_month', $direction) |
| 37 | 37 | ->orderBy('games_files.release_day', $direction) |
| 38 | 38 | ->select('games.*') |
| 39 | 39 | ->paginate(20); |
| 40 | - }else{ |
|
| 40 | + } else{ |
|
| 41 | 41 | $games = Game::orderBy($orderby,$direction)->orderBy('title')->orderBy('subtitle')->paginate(20); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | GamesDeveloper::whereGameId($id)->delete(); |
| 279 | 279 | Comment::whereContentId($id)->where('content_type', '=', 'game')->delete(); |
| 280 | 280 | TagRelation::whereContentId($id)->where('content_type', '=', 'game')->delete(); |
| 281 | - }else{ |
|
| 281 | + } else{ |
|
| 282 | 282 | return redirect()->action('GameController@edit', $id); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Store a newly created resource in storage. |
| 48 | 48 | * |
| 49 | 49 | * @param \Illuminate\Http\Request $request |
| 50 | - * @return \Illuminate\Http\Response |
|
| 50 | + * @return \Illuminate\Http\RedirectResponse |
|
| 51 | 51 | */ |
| 52 | 52 | public function store(Request $request) |
| 53 | 53 | { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @param \Illuminate\Http\Request $request |
| 135 | 135 | * @param int $id |
| 136 | - * @return \Illuminate\Http\Response |
|
| 136 | + * @return \Illuminate\Http\RedirectResponse |
|
| 137 | 137 | */ |
| 138 | 138 | public function update(Request $request, $id) |
| 139 | 139 | { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * Remove the specified resource from storage. |
| 159 | 159 | * |
| 160 | 160 | * @param int $id |
| 161 | - * @return \Illuminate\Http\Response |
|
| 161 | + * @return \Illuminate\Http\RedirectResponse |
|
| 162 | 162 | */ |
| 163 | 163 | public function destroy($id) |
| 164 | 164 | { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $news = \DB::table('news') |
| 20 | 20 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 21 | - ->leftJoin('comments', function($join){ |
|
| 21 | + ->leftJoin('comments', function($join) { |
|
| 22 | 22 | $join->on('comments.content_id', '=', 'news.id'); |
| 23 | 23 | $join->on('comments.content_type', '=', \DB::raw("'news'")); |
| 24 | 24 | }) |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function show($id) |
| 74 | 74 | { |
| 75 | - if(\Auth::check()){ |
|
| 76 | - if(UserSetting::whereUserId(\Auth::id())->first()->is_admin = 1){ |
|
| 75 | + if (\Auth::check()) { |
|
| 76 | + if (UserSetting::whereUserId(\Auth::id())->first()->is_admin = 1) { |
|
| 77 | 77 | $news = \DB::table('news') |
| 78 | 78 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 79 | 79 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
| 80 | 80 | ->where('news.id', '=', $id) |
| 81 | 81 | ->first(); |
| 82 | - }else{ |
|
| 82 | + }else { |
|
| 83 | 83 | $news = \DB::table('news') |
| 84 | 84 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 85 | 85 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ->where('approved', '=', '1') |
| 88 | 88 | ->first(); |
| 89 | 89 | } |
| 90 | - }else{ |
|
| 90 | + }else { |
|
| 91 | 91 | $news = \DB::table('news') |
| 92 | 92 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 93 | 93 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return redirect()->action('NewsController@index'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function approve($id, $approve){ |
|
| 171 | + public function approve($id, $approve) { |
|
| 172 | 172 | $news = News::whereId($id)->first(); |
| 173 | 173 | $news->approved = $approve; |
| 174 | 174 | $news->save(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
| 80 | 80 | ->where('news.id', '=', $id) |
| 81 | 81 | ->first(); |
| 82 | - }else{ |
|
| 82 | + } else{ |
|
| 83 | 83 | $news = \DB::table('news') |
| 84 | 84 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 85 | 85 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ->where('approved', '=', '1') |
| 88 | 88 | ->first(); |
| 89 | 89 | } |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | $news = \DB::table('news') |
| 92 | 92 | ->leftJoin('users', 'news.user_id', '=', 'users.id') |
| 93 | 93 | ->select(['news.id', 'news.title', 'news.news_html', 'news_category', 'users.name', 'news.user_id', 'news.created_at', 'news.approved']) |
@@ -37,11 +37,11 @@ |
||
| 37 | 37 | |
| 38 | 38 | protected $guarded = []; |
| 39 | 39 | |
| 40 | - public function type(){ |
|
| 40 | + public function type() { |
|
| 41 | 41 | return $this->hasOne('App\Models\UserCreditType', 'id', 'credit_type_id'); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function user(){ |
|
| 44 | + public function user() { |
|
| 45 | 45 | return $this->hasOne('App\Models\User', 'id', 'user_id'); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -58,15 +58,15 @@ |
||
| 58 | 58 | |
| 59 | 59 | protected $guarded = []; |
| 60 | 60 | |
| 61 | - public function content(){ |
|
| 61 | + public function content() { |
|
| 62 | 62 | return $this->morphTo(); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function user(){ |
|
| 65 | + public function user() { |
|
| 66 | 66 | return $this->belongsTo('App\Models\User'); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function game(){ |
|
| 69 | + public function game() { |
|
| 70 | 70 | return $this->hasOne('App\Models\Game', 'id', 'content_id')->with('user', 'maker', 'gamefiles', 'language'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | protected $guarded = []; |
| 40 | 40 | |
| 41 | - public function user(){ |
|
| 41 | + public function user() { |
|
| 42 | 42 | return $this->hasOne('App\Models\User', 'id', 'user_id'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | |
| 39 | 39 | protected $guarded = []; |
| 40 | 40 | |
| 41 | - public function developer(){ |
|
| 41 | + public function developer() { |
|
| 42 | 42 | return $this->hasOne('App\Models\Developer', 'id', 'developer_id')->with('user'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function game(){ |
|
| 45 | + public function game() { |
|
| 46 | 46 | return $this->hasOne('App\Models\Game', 'id', 'game_id')->with('comments', 'maker', 'gamefiles', 'cdcs'); |
| 47 | 47 | } |
| 48 | 48 | |