Last active
November 22, 2017 05:40
-
-
Save Tjoosten/5e9632212c498b27586e234a8c68292e to your computer and use it in GitHub Desktop.
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
/** | |
* Get the create view for a new subscription. | |
* | |
* @return \Illuminate\View\View | |
*/ | |
public function create(): View | |
{ | |
return view('subscriptions.create', ['products' => $this->productRepository->entity()->where('type', 'Eten')->get()]); | |
} | |
/** | |
* Store the new subscription in the storage. | |
* | |
* @param TODO: Docblock validation | |
* @return \Illuminate\Http\RedirectResponse | |
*/ | |
public function store(SubscriptionValidator $input): RedirectResponse | |
{ | |
$order = $input->get('order'); | |
foreach($order as $key => $value) | |
{ | |
$arrData[] = array("productId"=>$order[$key], 'personen' => $order[$key]); | |
} | |
dd($arrData); | |
die(); | |
if ($subscription = $this->subscriptionsRepository->create($input->except('_token'))) { | |
flash("De inschrijving is toegevoegd in het systeem.")->success(); | |
// TODO: Send mail notification to the subscription user with his invoice. (queued) | |
// TODO; Register activity logger when the form user is an admin, verantwoordelijke. | |
} | |
return redirect()->route('inschrijvingen.index'); | |
} |
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
+----+-----------+-------------------+-------+------------+--------------------------+---------------------+---------------------+ | |
| id | author_id | name | price | type | description | created_at | updated_at | | |
+----+-----------+-------------------+-------+------------+--------------------------+---------------------+---------------------+ | |
| 1 | 9 | Kari Turner | 0 | Eten | WHAT?'. | 2017-11-22 02:55:57 | 2017-11-22 02:55:57 | | |
| 8 | 1 | d<dfvsdf | 20.00 | Eten | dsfsqdfsqdf | 2017-11-22 04:14:49 | 2017-11-22 04:14:49 | | |
+----+-----------+-------------------+-------+------------+--------------------------+---------------------+---------------------+ |
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
array:4 [▼ | |
0 => array:2 [▼ | |
"productId" => "1" | |
"personen" => "1" | |
] | |
1 => array:2 [▼ | |
"productId" => null | |
"personen" => null | |
] | |
2 => array:2 [▼ | |
"productId" => "8" | |
"personen" => "8" | |
] | |
3 => array:2 [▼ | |
"productId" => null | |
"personen" => null | |
] | |
] |
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
@if (count($products) > 0) | |
<fieldset> | |
<legend>Bestelling:</legend> | |
<div class="alert alert-warning alert-important alert-dismissable fade in" role="alert"> | |
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> | |
<strong><i class="fa fa-warning"></i> Info:</strong> | |
Bij het aantal personen word een getal verwacht. bv "2" en niet "2 personen." | |
</div> | |
@foreach ($products as $product) | |
<div class="form-group"> | |
<label class="control-label col-md-3">{{ $product->name }}:</label> | |
<div class="col-md-2"> | |
<label class="control-label">{{ $product->price }}€ per persoon</label> | |
</div> | |
<div class="col-md-2"> | |
<input type="hidden" @input('order[]', $product->id)> | |
<input type="text" class="form-control" @input('order[][personen]') placeholder="Aantal Personen"> | |
</div> | |
</div> | |
@endforeach | |
</fieldset> | |
@endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment