-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #265 from Zemill/BackendMigrationWork
Backend migration work
- Loading branch information
Showing
17 changed files
with
615 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Player; | ||
use App\Services\GlobalDataService; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
use App\Rules\SingleGameMapInputValidation; | ||
|
||
class PlayerMapsController extends Controller | ||
{ | ||
protected $globalDataService; | ||
|
||
public function __construct(GlobalDataService $globalDataService) | ||
{ | ||
$this->globalDataService = $globalDataService; | ||
} | ||
|
||
public function showAll(Request $request, $battletag, $blizz_id, $region) | ||
{ | ||
$validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ | ||
'battletag' => 'required|string', | ||
'blizz_id' => 'required|integer', | ||
'region' => 'required|integer' | ||
]); | ||
|
||
if ($validator->fails()) { | ||
return redirect('/'); | ||
} | ||
|
||
|
||
return view('Player.Maps.allMapData')->with([ | ||
'battletag' => $battletag, | ||
'blizz_id' => $blizz_id, | ||
'region' => $region, | ||
'filters' => $this->globalDataService->getFilterData(), | ||
]); | ||
} | ||
|
||
public function showSingle(Request $request, $battletag, $blizz_id, $region, $role){ | ||
$validator = \Validator::make(compact('battletag', 'blizz_id', 'region'), [ | ||
'battletag' => 'required|string', | ||
'blizz_id' => 'required|integer', | ||
'region' => 'required|integer' | ||
]); | ||
|
||
if ($validator->fails()) { | ||
return redirect('/'); | ||
} | ||
$map = (new SingleGameMapInputValidation())->passes('map', $request["map"]); | ||
|
||
|
||
return view('Player.Maps.singleMapData')->with([ | ||
'battletag' => $battletag, | ||
'blizz_id' => $blizz_id, | ||
'region' => $region, | ||
'map' => $map, | ||
'filters' => $this->globalDataService->getFilterData(), | ||
'regions' => $this->globalDataService->getRegionIDtoString(), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Rules; | ||
|
||
use Illuminate\Contracts\Validation\Rule; | ||
use App\Models\Map; | ||
|
||
class SingleGameMapInputValidation implements Rule | ||
{ | ||
public function passes($attribute, $value) | ||
{ | ||
$validMaps = Map::where('playable', '<>', 0) | ||
->pluck('name') | ||
->toArray(); | ||
|
||
if(!in_array($value, $validMaps)){ | ||
return; | ||
} | ||
|
||
$mapId = Map::where('name', $value) | ||
->pluck('map_id')->first(); | ||
|
||
return $mapId; | ||
} | ||
|
||
public function message() | ||
{ | ||
return 'The selected game types are invalid.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.