modify bids
This commit is contained in:
@@ -87,12 +87,27 @@ class ContractController extends Controller
|
||||
* Controller function to display current private contracts
|
||||
*/
|
||||
public function displayPrivateContracts() {
|
||||
//Declare our array variables
|
||||
$bids = array();
|
||||
$contracts = array();
|
||||
|
||||
//Calucate today's date to know which contracts to display
|
||||
$today = Carbon::now();
|
||||
|
||||
//Fetch all of the current contracts from the database
|
||||
$contracts = Contract::where('end_date', '>=', $today)
|
||||
$contractTemp = Contract::where('end_date', '>=', $today)
|
||||
->where(['type' => 'private'])->get();
|
||||
|
||||
//Count the number of bids, and add them to the arrays
|
||||
for($i = 0; $i < sizeof($contractsTemp); $i++) {
|
||||
$tempCount = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->count('contract_id');
|
||||
$bids = Bid::where(['contract_id' => $contractsTemp[$i]['contract_id']])->get()->toArray();
|
||||
|
||||
//Assemble the finaly array
|
||||
$contracts[$i] = $contractsTemp[$i];
|
||||
$contracts[$i]['bid_count'] = $tempCount;
|
||||
$contracts[$i]['bids'] = $bids;
|
||||
}
|
||||
|
||||
return view ('contracts.privatecontracts')->with('contracts', $contracts);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@foreach($contracts as $contract)
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
@@ -24,9 +25,17 @@
|
||||
{{ $contract['body'] }}
|
||||
</div>
|
||||
</span>
|
||||
<br>
|
||||
@foreach($contract['bids'] as $bid)
|
||||
@if(auth()->user()->character_id == $bid['character_id'])
|
||||
<a href="/contracts/modify/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Modify Bid</a>
|
||||
<a href="/contracts/delete/bid/{{ $bid['id'] }}" class="btn btn-primary" role="button">Delete Bid</a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
@endforeach
|
||||
Reference in New Issue
Block a user