diff --git a/app/Http/Controllers/Contracts/BuyContractController.php b/app/Http/Controllers/Contracts/BuyContractController.php deleted file mode 100644 index f111a2bb7..000000000 --- a/app/Http/Controllers/Contracts/BuyContractController.php +++ /dev/null @@ -1,35 +0,0 @@ -middleware('auth'); - $this->middleware('role:User'); - } - - /** - * Display region form to pick different regions such as Esoteria, Catch, Immensea - */ - public function displayRegionalContractForm() { - return view('contracts.regional.user.displayregion'); - } - - /** - * Display the contracts in a region - */ - public function displayRegionalContracts() { - $this->validate('request', [ - 'region_id' => 'required', - ]); - - return view('contracts.regional.user.displaycontracts'); - } -} diff --git a/app/Http/Controllers/Contracts/PublicContractController.php b/app/Http/Controllers/Contracts/PublicContractController.php new file mode 100644 index 000000000..03496df9f --- /dev/null +++ b/app/Http/Controllers/Contracts/PublicContractController.php @@ -0,0 +1,60 @@ + 10000025, + 'Catch' => 10000014, + 'Tenerifis' => 10000061, + 'The Forge' => 10000002, + 'Impass' => 10000031, + 'Esoteria' => 10000039, + 'Detorid' => 10000005, + 'Omist' => 10000062, + 'Feythabolis' => 10000056, + 'Insmother' => 10000009, + ]; + + /** + * Contracts construct + */ + public function __construct() { + $this->middleware('auth'); + $this->middleware('role:User'); + } + + /** + * Display the contracts in a region + */ + public function displayRegionalContracts() { + //Declare variables + $arrContracts = array(); + + //Get the contracts by region + foreach($region as $key => $value) { + $contracts = PublicContract::where([ + 'region_id' => $value, + ])->get()->toArray(); + + //Compile the array + foreach($contracts as $contract) { + array_push($arrContracts, $contract); + } + } + + return view('contracts.regional.user.displaycontracts'); + } +}