Homparty dev

This commit is contained in:
Kevin Adametz 2020-12-16 20:03:51 +01:00
parent 9252094a04
commit ac0d5b781e
60 changed files with 3443 additions and 293 deletions

View file

@ -82,7 +82,7 @@ class ContactController extends Controller
}
$checkout_mail = config('app.checkout_mail');
$checkout_mail = config('app.contact_mail');
if($user_shop){
Mail::to($contact['email'])->bcc([$user_shop->user->email, $checkout_mail])->send(new MailContact($contact));
}else{

View file

@ -26,19 +26,31 @@ class HomepartyController extends Controller
}
public function detail($token = null)
public function detail($token = null, $gid = null)
{
if(!$token){
abort(404);
}
$homeparty_user = HomepartyUser::where('token', $token)->where('token_active', true)->first();
if(!$homeparty_user){
$homeparty = Homeparty::where('token', $token)->where('token_active', true)->first();
if(!$homeparty){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
$homeparty_user = null;
if($gid){
if($gid === 'new'){
$homeparty_user = new HomepartyUser();
}else{
$homeparty_user = HomepartyUser::find($gid);
if(!$homeparty_user || $homeparty_user->homeparty_id !== $homeparty->id){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
}
}
$data = [
'homeparty' => $homeparty_user->homeparty,
'homeparty' => $homeparty,
'homeparty_user' => $homeparty_user,
];
@ -46,21 +58,33 @@ class HomepartyController extends Controller
}
public function detailStore($token = null)
public function detailStore($token = null, $gid = null)
{
if(!$token){
abort(404);
}
$homeparty_user = HomepartyUser::where('token', $token)->where('token_active', true)->first();
$homeparty = Homeparty::where('token', $token)->where('token_active', true)->first();
if(!$homeparty){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
if($gid === null){
$homeparty_user = HomepartyUser::create([
'homeparty_id' => $homeparty->id,
'auth_user_id' => $homeparty->auth_user_id,
'is_host' => false,
]);
}else{
$homeparty_user = HomepartyUser::find($gid);
if(!$homeparty_user || $homeparty_user->homeparty_id !== $homeparty->id){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
}
if(!$homeparty_user){
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
}
$rules = array(
'billing_salutation' => 'required',
'billing_firstname' => 'required',