Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Last active November 22, 2017 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/5e9632212c498b27586e234a8c68292e to your computer and use it in GitHub Desktop.
Save Tjoosten/5e9632212c498b27586e234a8c68292e to your computer and use it in GitHub Desktop.
/**
* 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');
}
+----+-----------+-------------------+-------+------------+--------------------------+---------------------+---------------------+
| 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 |
+----+-----------+-------------------+-------+------------+--------------------------+---------------------+---------------------+
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
]
]
@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">&times;</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