middleware('active.account');
}
public function index()
{
$data = [
];
return view('user.order.payment.index', $data);
}
public function detail($identifier)
{
$data = OrderPaymentService::getCustomPayment($identifier);
$data['backlink'] = route('user_order_payment_links');
return view('user.order.payment.custom_payment', $data);
}
public function delete($identifier)
{
$shoppingInstance = ShoppingInstance::where('identifier', $identifier)->firstOrFail();
$user = User::find(\Auth::user()->id);
$userShopId = $user->shop ? $user->shop->id : null;
if ((int) $shoppingInstance->user_shop_id !== (int) $userShopId) {
abort(403);
}
if (! OrderPaymentService::canDeleteInstance($shoppingInstance)) {
\Session()->flash('alert-error', __('abo.payment_link_delete_not_allowed'));
return redirect(route('user_order_payment_links'));
}
OrderPaymentService::deleteInstance($identifier);
\Session()->flash('alert-success', __('abo.payment_link_delete_success'));
return redirect(route('user_order_payment_links'));
}
public function datatable()
{
$user = User::find(\Auth::user()->id);
$user_shop_id = $user->shop ? $user->shop->id : null;
$query = ShoppingInstance::select('*')
->where('user_shop_id', '=', $user_shop_id)
->where('payment', 6);
return \DataTables::eloquent($query)
->addColumn('id', function (ShoppingInstance $shoppingInstance) {
return '';
})
->addColumn('created_at', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->created_at->format('d.m.Y');
})
->addColumn('status', function (ShoppingInstance $shoppingInstance) {
return OrderPaymentService::getStatusBadge($shoppingInstance);
})
->addColumn('payment_method', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->payment_method ? $shoppingInstance->payment_method->name : '-';
})
->addColumn('total', function (ShoppingInstance $shoppingInstance) {
if ($shoppingInstance->amount > 0) {
return ''.$shoppingInstance->getAmountFormatted().' €';
} else {
return '-';
}
})
->addColumn('type', function (ShoppingInstance $shoppingInstance) {
return OrderPaymentService::getTypeBadge($shoppingInstance);
})
->addColumn('billing_firstname', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_firstname'] ?? '-';
})
->addColumn('billing_lastname', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_lastname'] ?? '-';
})
->addColumn('billing_email', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_email'] ?? '-';
})
->addColumn('delete', function (ShoppingInstance $shoppingInstance) {
if (! OrderPaymentService::canDeleteInstance($shoppingInstance)) {
return '';
}
return '';
})
->orderColumn('id', 'identifier $1')
->orderColumn('created_at', 'created_at $1')
->orderColumn('status', 'status $1')
->orderColumn('total', 'total $1')
->orderColumn('type', 'type $1')
->orderColumn('billing_firstname', 'billing_firstname $1')
->orderColumn('billing_lastname', 'billing_lastname $1')
->orderColumn('billing_email', 'billing_email $1')
->rawColumns(['id', 'status', 'type', 'total', 'invoice', 'delete'])
->make(true);
}
}