Customers Add+Edit, API WP
This commit is contained in:
parent
dc63fa9fb2
commit
75a0f9a38a
120 changed files with 11894 additions and 6134 deletions
|
|
@ -9,8 +9,7 @@ use App\Repositories\UserRepository;
|
|||
use App\User;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ class AdminUserController extends Controller
|
|||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$user = User::findOrFail($data['id']);
|
||||
|
||||
if(isset($data['save-admin'])){
|
||||
|
|
|
|||
103
app/Http/Controllers/Api/AuthController.php
Executable file
103
app/Http/Controllers/Api/AuthController.php
Executable file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
||||
//protected static API_MAIL = 'api.thomas.krummel@gmail.com';
|
||||
//protected static API_PASS = 'UF(Q<9knap!ev3vH?5~!b8DP';
|
||||
//protected static API_URL = 'https://mein.sterntours.test/api/';
|
||||
|
||||
|
||||
public $successStatus = 200;
|
||||
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string',
|
||||
'remember_me' => 'boolean'
|
||||
]);
|
||||
$credentials = request(['email', 'password']);
|
||||
|
||||
if (!Auth::attempt($credentials))
|
||||
return response()->json([
|
||||
'message' => 'Unauthorized'
|
||||
], 401);
|
||||
$user = $request->user();
|
||||
|
||||
$tokenResult = $user->createToken('Personal Access Token');
|
||||
$token = $tokenResult->token;
|
||||
|
||||
if ($request->remember_me){
|
||||
$token->expires_at = Carbon::now()->addWeeks(1);
|
||||
}else{
|
||||
$token->expires_at = Carbon::now()->addDays(1);
|
||||
}
|
||||
|
||||
$token->save();
|
||||
return response()->json([
|
||||
'access_token' => $tokenResult->accessToken,
|
||||
'token_type' => 'Bearer',
|
||||
'expires_at' => Carbon::parse(
|
||||
$tokenResult->token->expires_at
|
||||
)->toDateTimeString()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function checked(Request $request)
|
||||
{
|
||||
return response()->json([
|
||||
'message' => 'login'
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$request->user()->token()->revoke();
|
||||
return response()->json([
|
||||
'message' => 'Successfully logged out'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the authenticated User
|
||||
*
|
||||
* @return [json] user object
|
||||
*/
|
||||
/* public function user(Request $request)
|
||||
{
|
||||
return response()->json($request->user());
|
||||
}
|
||||
*/
|
||||
|
||||
/*public function signup(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|string|email|unique:users',
|
||||
'password' => 'required|string|confirmed'
|
||||
]);
|
||||
$user = new User([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
$user->save();
|
||||
return response()->json([
|
||||
'message' => 'Successfully created user!'
|
||||
], 201);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
|
|||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Input;
|
||||
use Session;
|
||||
use \SoapClient;
|
||||
|
||||
|
|
|
|||
526
app/Http/Controllers/Api/ShoppingUserController.php
Executable file
526
app/Http/Controllers/Api/ShoppingUserController.php
Executable file
|
|
@ -0,0 +1,526 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Services\CustomerPriority;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Carbon\Carbon;
|
||||
use PHPUnit\Framework\Constraint\Count;
|
||||
use Yard;
|
||||
|
||||
|
||||
class ShoppingUserController extends Controller
|
||||
{
|
||||
|
||||
//protected static API_MAIL = 'api.thomas.krummel@gmail.com';
|
||||
//protected static API_PASS = 'UF(Q<9knap!ev3vH?5~!b8DP';
|
||||
|
||||
|
||||
protected $successStatus = 200;
|
||||
protected $member_id = 3; //thomas.krummel@gmail.com
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* wp_order_numbers[1234, 1234]
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function status(Request $request)
|
||||
{
|
||||
//$this->member_id = auth()->user()->m_sponsor;
|
||||
|
||||
$request->validate([
|
||||
'wp_order_numbers' => 'required',
|
||||
]);
|
||||
|
||||
$wp_order_numbers = json_decode($request->wp_order_numbers);
|
||||
|
||||
|
||||
if(!$wp_order_numbers || !is_array($wp_order_numbers)){
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'wp_order_numbers need as json [1234, 1234] ',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
$status = [];
|
||||
foreach ($wp_order_numbers as $wp_order_number){
|
||||
$shopping_user = ShoppingUser::where('wp_order_number', '=', $wp_order_number)->first();
|
||||
$status[] = [
|
||||
'wp_order_number' => $wp_order_number,
|
||||
'user' => $shopping_user ? true : false,
|
||||
'order' => ($shopping_user && $shopping_user->shopping_order) ? true : false,
|
||||
'status' => 'open | sent | ...',
|
||||
];
|
||||
}
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $status,
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* wp_order_numbers [1234, 1234]
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function show(Request $request)
|
||||
{
|
||||
//$this->member_id = auth()->user()->m_sponsor;
|
||||
$request->validate([
|
||||
'wp_order_numbers' => 'required',
|
||||
]);
|
||||
|
||||
$wp_order_numbers = json_decode($request->wp_order_numbers);
|
||||
|
||||
if(!$wp_order_numbers || !is_array($wp_order_numbers)){
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'wp_order_numbers need as json [1234, 1234] ',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
$data = [];
|
||||
|
||||
foreach ($wp_order_numbers as $wp_order_number){
|
||||
$shopping_user = ShoppingUser::where('wp_order_number', '=', $wp_order_number)->first();
|
||||
$user = false;
|
||||
$order = false;
|
||||
if ($shopping_user) {
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
$order = $this->prepareForShowOrder($shopping_user->shopping_order);
|
||||
}
|
||||
$data[] = [
|
||||
'wp_order_number' => $wp_order_number,
|
||||
'user' => $user,
|
||||
'order' => $order,
|
||||
'customer_number' => $shopping_user ? $shopping_user->number : false,
|
||||
'member_email' => ($shopping_user && $shopping_user->member) ? $shopping_user->member->email : false,
|
||||
'status' => 'open | sent | ...',
|
||||
];
|
||||
}
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $data,
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'billing_email' => 'required|string|email',
|
||||
'billing_firstname' => 'required|string',
|
||||
'billing_lastname' => 'required|string',
|
||||
'billing_address' => 'required|string',
|
||||
'billing_zipcode' => 'required|string',
|
||||
'billing_city' => 'required|string',
|
||||
'billing_country_code' => 'required|string',
|
||||
'wp_order_number' => 'required|int|unique:shopping_users,wp_order_number',
|
||||
'wp_order_date' => 'required|date',
|
||||
]);
|
||||
|
||||
$this->member_id = auth()->user()->m_sponsor;
|
||||
|
||||
$data = $this->prepareForStore($request->all());
|
||||
$data['member_id'] = $this->member_id ;
|
||||
$data['number'] = ShoppingUser::max('number') + 1;
|
||||
$data['mode'] = $request->mode ? $request->mode : 'live';
|
||||
|
||||
$shopping_user = ShoppingUser::create($data);
|
||||
|
||||
//Kundenhoheit prüfen
|
||||
$priority = CustomerPriority::checkOne($shopping_user, true, false);
|
||||
\App\Services\Shop::newUserOrder($shopping_user->number);
|
||||
//exists //like //update
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'wp_order_number' => $shopping_user->wp_order_number,
|
||||
'user' => $user,
|
||||
'customer_priority' => $priority,
|
||||
'customer_number' => $shopping_user->number,
|
||||
'member_email' => $shopping_user->member->email
|
||||
],
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'wp_order_number' => 'required|int',
|
||||
]);
|
||||
$shopping_user = ShoppingUser::where('wp_order_number', '=', $request->wp_order_number)->first();
|
||||
if (!$shopping_user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Entry with wp_order_number ' . $request->wp_order_number . ' not found',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
|
||||
$data = $this->prepareForUpdate($request->all());
|
||||
//Kundenhoheit prüfen
|
||||
$priority = CustomerPriority::checkChangeOne($shopping_user, $data, true);
|
||||
$updated = $shopping_user->fill($data)->save();
|
||||
\App\Services\Shop::newUserOrder($shopping_user->number);
|
||||
|
||||
if ($updated){
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
$order = $this->prepareForShowOrder($shopping_user->shopping_order);
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'wp_order_number' => $shopping_user->wp_order_number,
|
||||
'user' => $user,
|
||||
'order' => $order,
|
||||
'customer_priority' => $priority,
|
||||
'customer_number' => $shopping_user ? $shopping_user->number : false,
|
||||
'member_email' => ($shopping_user && $shopping_user->member) ? $shopping_user->member->email : false,
|
||||
'status' => 'open | sent | ...',
|
||||
],
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 200);
|
||||
}
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Entry could not be updated'
|
||||
], 500);
|
||||
}
|
||||
|
||||
public function order(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'wp_order_number' => 'required|int',
|
||||
'wp_order' => 'required',
|
||||
]);
|
||||
|
||||
$shopping_user = ShoppingUser::where('wp_order_number', '=', $request->wp_order_number)->first();
|
||||
if (!$shopping_user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Entry with wp_order_number ' . $request->wp_order_number . ' not found',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
|
||||
if($shopping_user->shopping_order){
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Order with wp_order_number ' . $request->wp_order_number . ' exists',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
|
||||
$wp_order = json_decode($request->wp_order);
|
||||
$wp_order = $this->prepareOrder($wp_order, $shopping_user);
|
||||
if ($wp_order){
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
$order = $this->prepareForShowOrder($shopping_user->shopping_order);
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'wp_order_number' => $shopping_user->wp_order_number,
|
||||
'wp_order' => $wp_order,
|
||||
'user' => $user,
|
||||
'order' => $order,
|
||||
'customer_number' => $shopping_user->number,
|
||||
'member_email' => $shopping_user->member->email,
|
||||
],
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 200);
|
||||
}
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Order could not be stored'
|
||||
], 500);
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'wp_order_number' => 'required|int',
|
||||
]);
|
||||
$shopping_user = ShoppingUser::where('wp_order_number', '=', $request->wp_order_number)->where('mode', '=', 'dev')->first();
|
||||
if (!$shopping_user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Entry with wp_order_number ' . $request->wp_order_number . ' not found or mode != dev',
|
||||
'time' => Carbon::now()->toDateTimeString()
|
||||
], 400);
|
||||
}
|
||||
$shopping_order = $shopping_user->shopping_order;
|
||||
if($shopping_order){
|
||||
foreach ($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
$shopping_order_item->delete();
|
||||
}
|
||||
$shopping_order->delete();
|
||||
}
|
||||
if ($shopping_user->delete()) {
|
||||
return response()->json([
|
||||
'success' => true
|
||||
]);
|
||||
}
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Entry could not be deleted'
|
||||
], 500);
|
||||
}
|
||||
|
||||
private function prepareForShow($shopping_user){
|
||||
|
||||
if(!$shopping_user){
|
||||
return false;
|
||||
}
|
||||
|
||||
$shopping_user_data = $shopping_user->toArray();
|
||||
$needs = ['wp_order_number', 'wp_order_date', 'billing_company', 'billing_firstname', 'billing_lastname', 'billing_address', 'billing_address_2', 'billing_zipcode', 'billing_city', 'billing_phone', 'billing_email',
|
||||
'same_as_billing', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_phone',
|
||||
'created_at', 'updated_at', 'user_deleted_at']; //'has_buyed', 'subscribed',
|
||||
|
||||
//$salutation = array('mr' => 1, 'ms' => 2);
|
||||
$ret = [];
|
||||
foreach ($shopping_user_data as $key=>$value){
|
||||
|
||||
if($key === 'billing_country_id'){
|
||||
$ret['billing_country_code'] = $shopping_user->billing_country_id ? $shopping_user->billing_country->code : null;
|
||||
}
|
||||
if($key === 'shipping_country_id'){
|
||||
$ret['shipping_country_code'] = $shopping_user->shipping_country_id ? $shopping_user->shipping_country->code : null;
|
||||
}
|
||||
if($key === 'billing_salutation'){
|
||||
$ret['billing_salutation'] = $shopping_user->billing_salutation === 'ms' ? 2 : 1;
|
||||
}
|
||||
if($key === 'shipping_salutation'){
|
||||
$ret['shipping_salutation'] = $shopping_user->shipping_salutation === 'ms' ? 2 : 1;
|
||||
}
|
||||
|
||||
if(in_array($key, $needs)){
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function prepareForShowOrder($shopping_order){
|
||||
|
||||
if(!$shopping_order){
|
||||
return false;
|
||||
}
|
||||
$ret = [
|
||||
'country' => isset($shopping_order->shipping_country->country->code) ? $shopping_order->shipping_country->country->code : '',
|
||||
'total' => ($shopping_order->total*100),
|
||||
'shipping' => ($shopping_order->shipping*100),
|
||||
'total_net' => ($shopping_order->subtotal*100),
|
||||
'tax_rate' => ($shopping_order->tax_rate*100),
|
||||
'tax' => ($shopping_order->tax*100),
|
||||
'total_with_shipping' => ($shopping_order->total_shipping*100),
|
||||
'weight' => $shopping_order->weight,
|
||||
];
|
||||
$ret['items'] = [];
|
||||
foreach ($shopping_order->shopping_order_items as $item){
|
||||
$ret['items'][] = [
|
||||
'article' => $item->product->wp_number,
|
||||
'name' => $item->product->name,
|
||||
'qty' => $item->qty,
|
||||
'price' => ($item->price * 100),
|
||||
];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function prepareForUpdate($data){
|
||||
|
||||
//$salutation = array(1 => 'mr', 2 => 'ms', 3=>null);
|
||||
$ret = [];
|
||||
$needs = [ 'billing_salutation', 'billing_company', 'billing_firstname', 'billing_lastname', 'billing_address', 'billing_address_2', 'billing_zipcode', 'billing_city', 'billing_phone', 'billing_email',
|
||||
'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_phone'];
|
||||
|
||||
foreach ($data as $key=>$value){
|
||||
|
||||
if($key === 'billing_salutation') {
|
||||
$ret['billing_salutation'] = $data['billing_salutation'] == 2 ? 'ms' : 'mr';
|
||||
}
|
||||
if($key === 'shipping_salutation') {
|
||||
$ret['shipping_salutation'] = $data['shipping_salutation'] == 2 ? 'ms' : 'mr';
|
||||
}
|
||||
if($key === 'billing_country_code' && isset($data['billing_country_code'])) {
|
||||
$ret['billing_country_id'] = Country::getCountryIdByCodeOrOne($data['billing_country_code']);
|
||||
}
|
||||
if($key === 'shipping_country_code' && isset($data['shipping_country_code']) ) {
|
||||
$ret['shipping_country_id'] = Country::getCountryIdByCodeOrOne($data['shipping_country_code']);
|
||||
}
|
||||
if($key === 'billing_phone') {
|
||||
$ret['billing_phone'] = strlen($data['billing_phone']) <= 3 ? '' : $data['billing_phone'];
|
||||
}
|
||||
if($key === 'shipping_phone') {
|
||||
$ret['shipping_phone'] = strlen($data['shipping_phone']) <= 3 ? '' : $data['shipping_phone'];
|
||||
}
|
||||
if(in_array($key, $needs)){
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function prepareForStore($data){
|
||||
|
||||
//$salutation = array(1 => 'mr', 2 => 'ms', 3=>null);
|
||||
$ret = [];
|
||||
$needs = [ 'billing_salutation', 'billing_company', 'billing_firstname', 'billing_lastname', 'billing_address', 'billing_address_2', 'billing_zipcode', 'billing_city', 'billing_country_id', 'billing_phone', 'billing_email',
|
||||
'shipping_salutation', 'shipping_company', 'shipping_firstname', 'shipping_lastname', 'shipping_address', 'shipping_address_2', 'shipping_zipcode', 'shipping_city', 'shipping_country_id', 'shipping_phone',
|
||||
//'same_as_billing', 'has_buyed', 'subscribed',
|
||||
'wp_order_number', 'wp_order_date'];
|
||||
|
||||
foreach ($needs as $need){
|
||||
|
||||
$ret[$need] = isset($data[$need]) ? $data[$need] : null;
|
||||
|
||||
if ($need === 'billing_salutation' && $ret[$need] !== null) {
|
||||
$ret['billing_salutation'] = $ret['billing_salutation'] == 2 ? 'ms' : 'mr';
|
||||
}
|
||||
if ($need === 'shipping_salutation' && $ret[$need] !== null) {
|
||||
$ret['shipping_salutation'] = $ret['shipping_salutation'] == 2 ? 'ms' : 'mr';
|
||||
}
|
||||
if ($need === 'billing_country_id') {
|
||||
$ret['billing_country_id'] = isset($data['billing_country_code']) ? Country::getCountryIdByCodeOrOne($data['billing_country_code']) : 1;
|
||||
}
|
||||
if ($need === 'shipping_country_id') {
|
||||
$ret['shipping_country_id'] = isset($data['shipping_country_code']) ? Country::getCountryIdByCodeOrOne($data['shipping_country_code']) : $ret['billing_country_id'];
|
||||
}
|
||||
if ($need === 'billing_phone' && $ret[$need] !== null) {
|
||||
$ret['billing_phone'] = strlen($data['billing_phone']) <= 3 ? '' : $data['billing_phone'];
|
||||
}
|
||||
if ($need === 'shipping_phone' && $ret[$need] !== null) {
|
||||
$ret['shipping_phone'] = strlen($data['shipping_phone']) <= 3 ? '' : $data['shipping_phone'];
|
||||
}
|
||||
if ($need === 'wp_order_date') {
|
||||
$ret['wp_order_date'] = Carbon::parse($ret['wp_order_date'])->toDateTimeString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$ret['same_as_billing'] = $ret['shipping_lastname'] !== null ? true : false;
|
||||
$ret['has_buyed'] = true;
|
||||
$ret['subscribed'] = false;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function prepareOrder($wp_shopping_order, $shopping_user){
|
||||
Yard::instance('shopping')->destroy();
|
||||
$ret = [];
|
||||
|
||||
if(is_array($wp_shopping_order)){
|
||||
foreach ($wp_shopping_order as $order) {
|
||||
$error = [];
|
||||
if (!isset($order->article) || !isset($order->qty) || !isset($order->price)) {
|
||||
$error[] = "article parameter is missing";
|
||||
} else {
|
||||
|
||||
$product = Product::whereWpNumber($order->article)->first();
|
||||
if (!$product) {
|
||||
$error[] = "article not found";
|
||||
} else {
|
||||
if ($order->price != ($product->price * 100)) {
|
||||
$error[] = "different price: " . ($product->price * 100);
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
}
|
||||
}
|
||||
$order->message = $error;
|
||||
$ret[] = $order;
|
||||
}
|
||||
|
||||
$ShippingCountry = ShippingCountry::whereCountryId($shopping_user->shipping_country_id)->first();
|
||||
if($ShippingCountry){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($ShippingCountry->id);
|
||||
}
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user);
|
||||
$shopping_user->shopping_order = $shopping_order;
|
||||
Yard::instance('shopping')->destroy();
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function makeShoppingOrder($shopping_user){
|
||||
|
||||
$data = [
|
||||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'user_shop_id' => auth()->user()->user_sponsor->shop->id,
|
||||
'member_id' => $shopping_user->member_id,
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ''),
|
||||
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
|
||||
'subtotal' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
|
||||
'tax_rate' => Yard::getTaxRate(),
|
||||
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
|
||||
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
|
||||
'weight' => Yard::instance('shopping')->weight(),
|
||||
'paid' => true,
|
||||
'txaction' => 'extern',
|
||||
'mode' => $shopping_user->mode,
|
||||
];
|
||||
$shopping_order = $shopping_user->shopping_order;
|
||||
if($shopping_order){
|
||||
$shopping_order->fill($data);
|
||||
$shopping_order->save();
|
||||
}else{
|
||||
$shopping_order= ShoppingOrder::create($data);
|
||||
}
|
||||
$items = Yard::instance('shopping')->content();
|
||||
|
||||
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order) {
|
||||
foreach ($items as $item) {
|
||||
if ($model->row_id === $item->rowId) {
|
||||
$model->fill([
|
||||
'shopping_order_id' => $shopping_order->id,
|
||||
'row_id' => $item->rowId,
|
||||
'product_id' => $item->id,
|
||||
'qty' => $item->qty,
|
||||
'price' => $item->price,
|
||||
'slug' => $item->options->slug,
|
||||
])->save();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $model->delete();
|
||||
});
|
||||
|
||||
|
||||
foreach ($items as $item) {
|
||||
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count())
|
||||
ShoppingOrderItem::create([
|
||||
'shopping_order_id' => $shopping_order->id,
|
||||
'row_id' => $item->rowId,
|
||||
'product_id' => $item->id,
|
||||
'qty' => $item->qty,
|
||||
'price' => $item->price,
|
||||
'slug' => $item->options->slug
|
||||
]);
|
||||
}
|
||||
return $shopping_order;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\ProductAttribute;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
|
||||
class AttributeController extends Controller
|
||||
|
|
@ -29,7 +29,7 @@ class AttributeController extends Controller
|
|||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = Attribute::create([
|
||||
'parent_id' => null,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Category;
|
||||
use App\Models\IqImage;
|
||||
use App\Models\ProductCategory;
|
||||
use Input;
|
||||
use\Request;
|
||||
|
||||
|
||||
class CategoryController extends Controller
|
||||
|
|
@ -45,7 +45,7 @@ class CategoryController extends Controller
|
|||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['parent_id'] = isset($data['parent_id']) ? $data['parent_id'] : null;
|
||||
if($data['id'] == "new"){
|
||||
|
|
@ -105,7 +105,7 @@ class CategoryController extends Controller
|
|||
|
||||
public function imageUpload(){
|
||||
|
||||
$category_id = Input::get('category_id');
|
||||
$category_id = Request::get('category_id');
|
||||
$category = Category::findOrFail($category_id);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
use App\Models\Country;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
|
||||
class CountryController extends Controller
|
||||
|
|
@ -48,7 +48,14 @@ class CountryController extends Controller
|
|||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['switch'] = isset($data['switch']) ? true : false;
|
||||
$data['own_eur'] = isset($data['own_eur']) ? true : false;
|
||||
$data['currency'] = isset($data['currency']) ? true : false;
|
||||
$data['currency_faktor'] = $data['currency_faktor'] == "" ? null : reFormatNumber($data['currency_faktor']);
|
||||
|
||||
if(!isset($data['attr'])){
|
||||
$data['attr'] = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Repositories\CustomerRepository;
|
|||
use App\Services\CustomerPriority;
|
||||
use App\Services\HTMLHelper;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class CustomerController extends Controller
|
||||
|
|
@ -35,6 +36,17 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => true,
|
||||
'isView' => 'customer',
|
||||
];
|
||||
return view('admin.customer.detail', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
if($id === "new"){
|
||||
|
|
@ -49,31 +61,75 @@ class CustomerController extends Controller
|
|||
'isView' => 'customer',
|
||||
|
||||
];
|
||||
return view('admin.customer.detail', $data);
|
||||
return view('admin.customer.edit', $data);
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Request::all();
|
||||
$change_member_error = false;
|
||||
if($data['action']==='shopping-user-change-member'){
|
||||
if(!isset($data['change_member_key']) || $data['change_member_key'] !== config('mivita.edit_data_pass')){
|
||||
$change_member_error = "Das Passwort ist falsch.";
|
||||
}else{
|
||||
//change
|
||||
$shopping_user = ShoppingUser::findOrFail($data['id']);
|
||||
CustomerPriority::newMemberForCustomer($shopping_user, $data['change_member_id'], $data['customer_set_member_for']);
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_customer_edit', [$shopping_user->id]));
|
||||
|
||||
if ($data['action'] === 'shopping-user-change-member') {
|
||||
if (!isset($data['change_member_key']) || $data['change_member_key'] !== config('mivita.edit_data_pass')) {
|
||||
$data = [
|
||||
'change_member_error' => "Das Passwort ist falsch.",
|
||||
'shopping_user' => ShoppingUser::find($id),
|
||||
'isAdmin' => true,
|
||||
'isView' => 'customer',
|
||||
];
|
||||
return view('admin.customer.detail', $data);
|
||||
}
|
||||
//change
|
||||
$shopping_user = ShoppingUser::findOrFail($data['id']);
|
||||
CustomerPriority::newMemberForCustomer($shopping_user, $data['change_member_id'], $data['customer_set_member_for']);
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_customer_detail', [$shopping_user->id]));
|
||||
}
|
||||
$data = [
|
||||
'change_member_error' => $change_member_error,
|
||||
'shopping_user' => ShoppingUser::find($id),
|
||||
'isAdmin' => true,
|
||||
'isView' => 'customer',
|
||||
];
|
||||
return view('admin.customer.detail', $data);
|
||||
if ($data['action'] === 'shopping-user-store') {
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
'billing_firstname'=>'required',
|
||||
'billing_lastname'=>'required',
|
||||
'billing_email'=>'required|email',
|
||||
'billing_address'=>'required',
|
||||
'billing_zipcode'=>'required',
|
||||
'billing_city' => 'required',
|
||||
'billing_country_id' => 'required'
|
||||
);
|
||||
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
'shipping_address'=>'required',
|
||||
'shipping_zipcode'=>'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required',
|
||||
'shipping_country_id' => 'required'
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$data['has_buyed'] = true;
|
||||
$data['subscribed'] = true;
|
||||
if($shopping_user->auth_user_id > 0){
|
||||
$data['has_buyed'] = true;
|
||||
$data['subscribed'] = false;
|
||||
}
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
|
||||
CustomerPriority::checkChangeOne($shopping_user, $data, true);
|
||||
$shopping_user->fill($data);
|
||||
$shopping_user->save();
|
||||
\App\Services\Shop::newUserOrder($shopping_user->number);
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
}
|
||||
return redirect(route('admin_customer_detail', [$shopping_user->id]));
|
||||
|
||||
}
|
||||
|
||||
public function getCustomers()
|
||||
|
|
@ -95,7 +151,7 @@ class CustomerController extends Controller
|
|||
}*/
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingUser $ShoppingUser) {
|
||||
return '<a href="' . route('admin_customer_edit', [$ShoppingUser->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
return '<a href="' . route('admin_customer_detail', [$ShoppingUser->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('billing_salutation', function (ShoppingUser $ShoppingUser) {
|
||||
return HTMLHelper::getSalutationLang($ShoppingUser->billing_salutation);
|
||||
|
|
@ -104,7 +160,7 @@ class CustomerController extends Controller
|
|||
return $ShoppingUser->billing_country ? $ShoppingUser->billing_country->getLocated() : '';
|
||||
})
|
||||
->addColumn('isMember', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->auth_user_id ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
return get_active_badge($ShoppingUser->auth_user_id).($ShoppingUser->mode==='dev' ? ' <span class="badge badge-warning">dev</span>' : '');
|
||||
})
|
||||
->addColumn('member_id', function (ShoppingUser $ShoppingUser) {
|
||||
if($ShoppingUser->member_id){
|
||||
|
|
@ -123,13 +179,17 @@ class CustomerController extends Controller
|
|||
->addColumn('created_at', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->created_at->format('d.m.Y');
|
||||
})
|
||||
->addColumn('subscribed', function (ShoppingUser $ShoppingUser) {
|
||||
return get_active_badge($ShoppingUser->subscribed);
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('billing_country_id', 'billing_country_id $1')
|
||||
->orderColumn('billing_salutation', 'billing_salutation $1')
|
||||
->orderColumn('created_at', 'created_at $1')
|
||||
->orderColumn('isMember', 'auth_user_id $1')
|
||||
->orderColumn('member_id', 'member_id $1')
|
||||
->rawColumns(['id', 'isMember', 'member_id'])
|
||||
->orderColumn('subscribed', 'subscribed $1')
|
||||
->rawColumns(['id', 'subscribed', 'isMember', 'member_id'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ class DataTableController extends Controller
|
|||
|
||||
public function getUsers()
|
||||
{
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null);
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Auth;
|
|||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use Request;
|
||||
use Input;
|
||||
use Util;
|
||||
|
||||
class HomeController extends Controller
|
||||
|
|
@ -48,8 +47,8 @@ class HomeController extends Controller
|
|||
|
||||
public function loadingModal(){
|
||||
|
||||
$data = Input::get('data');
|
||||
$target = Input::get('target');
|
||||
$data = Request::get('data');
|
||||
$target = Request::get('target');
|
||||
|
||||
$response = "";
|
||||
if($data === "data_protection"){
|
||||
|
|
@ -203,7 +202,7 @@ class HomeController extends Controller
|
|||
*/
|
||||
public function checkMail(){
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
if($data['user_id'] === "new"){
|
||||
if(User::where('email', $data['email'])->count()){
|
||||
return json_encode(false);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Product;
|
||||
use App\Models\ProductImage;
|
||||
use App\Repositories\ProductRepository;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
|
||||
use App\Mail\MailCustomMessage;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Mail\MailVerifyContact;
|
||||
|
|
@ -15,12 +13,9 @@ use App\Repositories\UserRepository;
|
|||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
||||
class LeadController extends Controller
|
||||
{
|
||||
protected $userRepo;
|
||||
|
|
@ -64,7 +59,7 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
$data = [
|
||||
'show' => Input::get('show'),
|
||||
'show' => Request::get('show'),
|
||||
'user' => $user,
|
||||
'can_change_mail' => true,
|
||||
'm_data_load' => false,
|
||||
|
|
@ -120,8 +115,8 @@ class LeadController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$show = Input::get('show');
|
||||
$data = Request::all();
|
||||
$show = Request::get('show');
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
|
|
@ -142,7 +137,7 @@ class LeadController extends Controller
|
|||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
if(!Input::get('same_as_billing')){
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
|
|
@ -161,7 +156,7 @@ class LeadController extends Controller
|
|||
|
||||
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
|
|
@ -170,7 +165,7 @@ class LeadController extends Controller
|
|||
$user = User::findOrFail($data['user_id']);
|
||||
$user_id = $user->id;
|
||||
}
|
||||
return redirect(route('admin_lead_edit', [$user_id])."?show=".$show)->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('admin_lead_edit', [$user_id])."?show=".$show)->withErrors($validator)->withRequest(Request::all());
|
||||
}
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
|
|
@ -224,7 +219,7 @@ class LeadController extends Controller
|
|||
$user = User::findOrFail($id);
|
||||
|
||||
if($action === 'completed'){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
if(!$user->m_sponsor){
|
||||
$validator->errors()->add('m_sponsor', __('Berater hat keinen Sponsor.'));
|
||||
}
|
||||
|
|
@ -238,7 +233,7 @@ class LeadController extends Controller
|
|||
$validator->errors()->add('m_account', __('Berater hat keine Account ID'));
|
||||
}
|
||||
if ($validator->errors()->count()) {
|
||||
return back()->withErrors($validator)->withInput(Input::all());
|
||||
return back()->withErrors($validator)->withRequest(Request::all());
|
||||
}
|
||||
|
||||
//create PDF
|
||||
|
|
@ -276,7 +271,7 @@ class LeadController extends Controller
|
|||
$user->release_account = null;
|
||||
$user->save();
|
||||
|
||||
$input = Input::all();
|
||||
$input = Request::all();
|
||||
$data = [
|
||||
'subject' => $input['account_incomplete_subject'],
|
||||
'message' => $input['account_incomplete_message'],
|
||||
|
|
@ -340,7 +335,7 @@ class LeadController extends Controller
|
|||
public function getLeads()
|
||||
{
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null);
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use Carbon;
|
|||
use Config;
|
||||
use Illuminate\Validation\Rules\In;
|
||||
use Request;
|
||||
use Input;
|
||||
use Util;
|
||||
use Yard;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -62,11 +61,11 @@ class MembershipController extends Controller
|
|||
public function storePayment($action){
|
||||
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
//#### remove_abo
|
||||
if($action === "remove_abo"){
|
||||
if(Input::get('abo_options_remove')){
|
||||
if(Request::get('abo_options_remove')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user->abo_options = false;
|
||||
$user->save();
|
||||
|
|
@ -82,12 +81,12 @@ class MembershipController extends Controller
|
|||
//#### payment order
|
||||
//#### shop upgrade
|
||||
if($action === "upgrade_order" || $action === "payment_order"){
|
||||
if(Input::get('switchers-package-wizard')){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Input::get('switchers-package-wizard'));
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
$showAboOptions = false;
|
||||
if(Input::get('abo_options')){
|
||||
if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
|
|
@ -97,7 +96,7 @@ class MembershipController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$qty = Input::get('qty') ? Input::get('qty') : 1;
|
||||
$qty = Request::get('qty') ? Request::get('qty') : 1;
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
do {
|
||||
|
|
@ -124,9 +123,9 @@ class MembershipController extends Controller
|
|||
}
|
||||
|
||||
if($action === "change_order"){
|
||||
if(Input::get('switchers-package-wizard')){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
$product = Product::find(Input::get('switchers-package-wizard'));
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
if($user->payment_order_id == $product->id){
|
||||
\Session()->flash('alert-success', "keine Änderung vorgenommen.");
|
||||
return back();
|
||||
|
|
@ -142,7 +141,7 @@ class MembershipController extends Controller
|
|||
}
|
||||
}
|
||||
if($action === "delete_membership"){
|
||||
if(Input::get('delete_membership_mivita')){
|
||||
if(Request::get('delete_membership_mivita')){
|
||||
//TODO
|
||||
$user = User::find(Auth::user()->id);
|
||||
if($user->isTestMode()){
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductImage;
|
||||
use App\Repositories\ProductRepository;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
|
@ -47,8 +47,11 @@ class ProductController extends Controller
|
|||
}else{
|
||||
$model = Product::findOrFail($id);
|
||||
}
|
||||
|
||||
$country_for_prices = Country::where('own_eur', '=', true)->orWhere('currency', '=', true)->get();
|
||||
$data = [
|
||||
'product' => $model,
|
||||
'country_for_prices' => $country_for_prices,
|
||||
];
|
||||
return view('admin.product.edit', $data);
|
||||
}
|
||||
|
|
@ -56,12 +59,12 @@ class ProductController extends Controller
|
|||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if($data['id'] == "new"){
|
||||
$model = new Product();
|
||||
|
|
@ -77,7 +80,7 @@ class ProductController extends Controller
|
|||
return view('admin.product.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$product = $this->productRepo->update(Input::all());
|
||||
$product = $this->productRepo->update(Request::all());
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
}
|
||||
|
|
@ -111,7 +114,7 @@ class ProductController extends Controller
|
|||
|
||||
public function imageUpload(){
|
||||
|
||||
$product_id = Input::get('product_id');
|
||||
$product_id = Request::get('product_id');
|
||||
$product = Product::findOrFail($product_id);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserShop;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Services\Payment;
|
||||
use App\User;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
class SalesController extends Controller
|
||||
|
|
@ -140,8 +137,9 @@ class SalesController extends Controller
|
|||
$shopping_user = ShoppingUser::findOrFail($data['id']);
|
||||
$set_like_shopping_user = ShoppingUser::findOrFail($data['is_like_shopping_user_id']);
|
||||
$send_member_mail = isset($data['send_member_mail']) ? true : false;
|
||||
$change_shopping_user = isset($data['change_shopping_user']) ? true : false;
|
||||
//Mail send in setIsLike
|
||||
CustomerPriority::setIsLike($shopping_user, $set_like_shopping_user, $send_member_mail);
|
||||
CustomerPriority::setIsLike($shopping_user, $set_like_shopping_user, $send_member_mail, $change_shopping_user);
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect($data['back']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Shipping;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShippingPrice;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
|
@ -58,7 +57,7 @@ class ShippingController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$shipping = false;
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] == 'shipping'){
|
||||
if ($data['id'] == "new") {
|
||||
|
|
@ -69,11 +68,11 @@ class ShippingController extends Controller
|
|||
$rules = array('name' => 'required');
|
||||
}
|
||||
$ret = ['value' => $shipping];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return view('admin.shipping.edit', $ret)->withErrors($validator);
|
||||
}
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$shipping->name = $data['name'];
|
||||
$shipping->free = $data['free'];
|
||||
$shipping->active = isset($data['active']) ? true : false;
|
||||
|
|
@ -84,7 +83,7 @@ class ShippingController extends Controller
|
|||
$shipping = Shipping::findOrFail($data['shipping_id']);
|
||||
$rules = array('price' => 'required');
|
||||
$ret = ['value' => $shipping];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return view('admin.shipping.edit', $ret)->withErrors($validator);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Models\IqImage;
|
||||
use App\Models\IqSite;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
|
||||
class SitesController extends Controller
|
||||
|
|
@ -31,7 +31,7 @@ class SitesController extends Controller
|
|||
|
||||
public function store($site)
|
||||
{
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$data['products'] = isset($data['products']) ? $data['products'] : null;
|
||||
$data['set_products'] = isset($data['set_products']) ? $data['set_products'] : null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Sys;
|
||||
|
||||
namespace App\Http\Controllers\SyS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Api\KasController;
|
||||
|
|
@ -14,8 +13,7 @@ use App\Services\CustomerPriority;
|
|||
use App\Services\Shop;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
|
||||
|
||||
class AdminToolsController extends Controller
|
||||
|
|
@ -39,7 +37,7 @@ class AdminToolsController extends Controller
|
|||
public function customers()
|
||||
{
|
||||
|
||||
$shopping_users = CustomerPriority::checkForAll();
|
||||
$shopping_users = ShoppingUser::where('member_id', '=', NULL)->where('auth_user_id', '=', NULL)->get();
|
||||
$data = [
|
||||
'values' => $shopping_users,
|
||||
'text' => '',
|
||||
|
|
@ -47,10 +45,20 @@ class AdminToolsController extends Controller
|
|||
|
||||
return view('sys.admin.customers', $data);
|
||||
}
|
||||
|
||||
|
||||
public function customerStore()
|
||||
{
|
||||
$data = Input::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
$data = Request::all();
|
||||
if($data['action'] === 'checkForAll'){
|
||||
$shopping_users = CustomerPriority::checkForAll();
|
||||
}
|
||||
if(strpos($data['action'], 'checkOne_') !== false){
|
||||
$id = (int) str_replace('checkOne_', '', $data['action']);
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$ret = CustomerPriority::checkOne($shopping_user);
|
||||
}
|
||||
\Session()->flash('alert-success', $ret);
|
||||
return back();
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +81,7 @@ class AdminToolsController extends Controller
|
|||
}
|
||||
public function cronjobsStore()
|
||||
{
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
|
@ -114,7 +122,7 @@ class AdminToolsController extends Controller
|
|||
}
|
||||
public function domainSSLStore()
|
||||
{
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
\Session()->flash('alert-save', true);
|
||||
return back();
|
||||
}
|
||||
|
|
@ -132,7 +140,7 @@ class AdminToolsController extends Controller
|
|||
public function shoppingOrdersStore()
|
||||
{
|
||||
//first run
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'first_run'){
|
||||
$shopping_users = ShoppingUser::whereHas('shopping_order', function($q) {
|
||||
|
|
|
|||
54
app/Http/Controllers/Sys/ImportController.php
Executable file
54
app/Http/Controllers/Sys/ImportController.php
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\SyS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\ImportRepository;
|
||||
use Request;
|
||||
|
||||
|
||||
class ImportController extends Controller
|
||||
{
|
||||
protected $userRepo;
|
||||
protected $import;
|
||||
|
||||
public function __construct(ImportRepository $import)
|
||||
{
|
||||
$this->middleware('sysadmin');
|
||||
$this->import = $import;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function import()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('sys.admin.import', $data);
|
||||
}
|
||||
|
||||
|
||||
public function importStore()
|
||||
{
|
||||
$input = Request::all();
|
||||
return $this->import->upload($input);
|
||||
}
|
||||
|
||||
public function importShow($type, $file, $skip = 0, $limit = 4000)
|
||||
{
|
||||
$import = $this->import->read($type, $file, $skip, $limit);
|
||||
$data = [
|
||||
'limit' => $limit,
|
||||
'type' => $type,
|
||||
'file' => $file,
|
||||
'import' => $import,
|
||||
'skip' => $skip,
|
||||
];
|
||||
return view('sys.admin.import-show', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App;
|
||||
use File;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
class TranslationController extends Controller
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ class TranslationController extends Controller
|
|||
|
||||
$path = $this->resourcePath($this->languagesPath);
|
||||
$file = $path.$language.".json";
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$this->backup($path, $language.".json");
|
||||
unset($data['_token']);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
|
||||
//use Input;
|
||||
//use Request;
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
|
|
@ -14,8 +10,6 @@ use Illuminate\Support\Collection;
|
|||
use App\Requests\TranslationRequest;
|
||||
|
||||
|
||||
|
||||
|
||||
class TranslationFileController extends Controller
|
||||
{
|
||||
|
||||
|
|
|
|||
220
app/Http/Controllers/User/CustomerController.php
Executable file
220
app/Http/Controllers/User/CustomerController.php
Executable file
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Repositories\CustomerRepository;
|
||||
use App\Services\CustomerPriority;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
protected $customerRepository;
|
||||
|
||||
public function __construct(CustomerRepository $customerRepository)
|
||||
{
|
||||
$this->middleware('active.account');
|
||||
$this->customerRepository = $customerRepository;
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if(Request::get('reset') === 'filter'){
|
||||
// set_user_attr('filter_member_id', null);
|
||||
// set_user_attr('filter_customer_member', null);
|
||||
return redirect(route('admin_customers'));
|
||||
}
|
||||
$data = [
|
||||
|
||||
];
|
||||
return view('user.customer.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id != \Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => false,
|
||||
'isView' => 'customer',
|
||||
|
||||
];
|
||||
return view('user.customer.detail', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id != \Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => false,
|
||||
'isView' => 'customer',
|
||||
|
||||
];
|
||||
return view('user.customer.edit', $data);
|
||||
}
|
||||
|
||||
public function add($id, $step=0)
|
||||
{
|
||||
if($id === "new"){
|
||||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->id = "new";
|
||||
}else{
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id != \Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
if(old('email') || old('billing_email')){
|
||||
$step = 1;
|
||||
$shopping_user->same_as_billing = true;
|
||||
}
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'isAdmin' => false,
|
||||
'isView' => $step === 0 ? 'customer' : 'customer-add',
|
||||
'step' => $step,
|
||||
'billing_email' => old('email'),
|
||||
|
||||
];
|
||||
return view('user.customer.add', $data);
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Request::all();
|
||||
|
||||
if($id === 'new' && $data['action'] === 'add_customer_step_email'){
|
||||
$rules = array(
|
||||
'email' => 'required|string|email|max:255|unique:shopping_users,billing_email',
|
||||
);
|
||||
$messages = [
|
||||
'unique' => __('validation.custom.unique_email_client'),
|
||||
];
|
||||
$validator = Validator::make(Request::all(), $rules, $messages);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
//okay, go to step 1
|
||||
return back()->withInput(Request::all());
|
||||
|
||||
}
|
||||
|
||||
if($data['action'] === 'shopping-user-store-new' || $data['action']==='shopping-user-store'){
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
'billing_firstname'=>'required',
|
||||
'billing_lastname'=>'required',
|
||||
'billing_email'=>'required|email',
|
||||
'billing_address'=>'required',
|
||||
'billing_zipcode'=>'required',
|
||||
'billing_city' => 'required',
|
||||
'billing_country_id' => 'required',
|
||||
);
|
||||
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
'shipping_address'=>'required',
|
||||
'shipping_zipcode'=>'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required',
|
||||
'shipping_country_id' => 'required'
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
|
||||
$data['has_buyed'] = isset($data['has_buyed']) ? true : false;
|
||||
$data['subscribed'] = isset($data['subscribed']) ? true : false;
|
||||
//subscribed can only true when has_buyed ist active
|
||||
$data['subscribed'] = $data['has_buyed'] ? $data['subscribed'] : false;
|
||||
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
|
||||
|
||||
if($id > 0 && $data['action'] === 'shopping-user-store'){
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id != \Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
CustomerPriority::checkChangeOne($shopping_user, $data, true);
|
||||
$shopping_user->fill($data);
|
||||
$shopping_user->save();
|
||||
}
|
||||
|
||||
if($id === 'new' && $data['action'] === 'shopping-user-store-new') {
|
||||
$shopping_user = ShoppingUser::create($data);
|
||||
$shopping_user->member_id = \Auth::user()->id;
|
||||
$shopping_user->save();
|
||||
CustomerPriority::checkNewOne($shopping_user, true);
|
||||
}
|
||||
\App\Services\Shop::newUserOrder($shopping_user->number);
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('user_customer_detail', [$shopping_user->id]));
|
||||
}
|
||||
|
||||
public function getCustomers()
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
|
||||
$query = ShoppingUser::select(['id', 'billing_company', 'billing_salutation', 'billing_firstname', 'billing_lastname', 'billing_email', 'billing_zipcode', 'billing_city', 'billing_country_id', 'orders', 'subscribed', 'created_at', 'number', 'mode', 'wp_order_number'])
|
||||
->where('shopping_users.member_id', '=', $user->id);
|
||||
//->groupBy('shopping_users.number');
|
||||
|
||||
/*set_user_attr('filter_member_id', Request::get('filter_member_id'));
|
||||
if(Request::get('filter_member_id') != ""){
|
||||
$query->where('member_id', '=', Request::get('filter_member_id'));
|
||||
}*/
|
||||
return \DataTables::eloquent($query)
|
||||
|
||||
->addColumn('id', function (ShoppingUser $ShoppingUser) {
|
||||
return '<a href="' . route('user_customer_detail', [$ShoppingUser->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('billing_salutation', function (ShoppingUser $ShoppingUser) {
|
||||
return HTMLHelper::getSalutationLang($ShoppingUser->billing_salutation);
|
||||
})
|
||||
->addColumn('billing_country_id', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->billing_country ? $ShoppingUser->billing_country->getLocated() : '';
|
||||
})
|
||||
->addColumn('first_created_at', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->firstEntryByNumber()->created_at->format('d.m.Y');
|
||||
})
|
||||
->addColumn('orders', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->lastEntryByNumber()->orders;
|
||||
})
|
||||
->addColumn('subscribed', function (ShoppingUser $ShoppingUser) {
|
||||
return get_active_badge($ShoppingUser->subscribed);
|
||||
})
|
||||
->addColumn('extras', function (ShoppingUser $ShoppingUser) {
|
||||
return $ShoppingUser->wp_order_number.($ShoppingUser->mode==='dev' ? ' <span class="badge badge-warning">dev</span>' : '');
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('billing_country_id', 'billing_country_id $1')
|
||||
->orderColumn('billing_salutation', 'billing_salutation $1')
|
||||
->orderColumn('first_created_at', 'created_at $1')
|
||||
->orderColumn('orders', 'orders $1')
|
||||
->orderColumn('subscribed', 'subscribed $1')
|
||||
->rawColumns(['id', 'subscribed', 'extras'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -26,11 +26,8 @@ class ShopSalesController extends Controller
|
|||
public function orderDetail($id)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_order = ShoppingOrder::find($id);
|
||||
if(!$shopping_order){
|
||||
abort(404);
|
||||
}
|
||||
if($shopping_order->user_shop_id !== $user->shop->id){
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
|
|
@ -43,7 +40,7 @@ class ShopSalesController extends Controller
|
|||
public function ordersDatatable(){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->select('shopping_orders.*')->where('user_shop_id', $user->shop->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->select('shopping_orders.*')->where('member_id', $user->id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Repositories\UserRepository;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ class UserDataController extends Controller
|
|||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
);
|
||||
if(!Input::get('same_as_billing')){
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
|
|
@ -69,14 +69,14 @@ class UserDataController extends Controller
|
|||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$this->userRepo->update(Input::all());
|
||||
$this->userRepo->update(Request::all());
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect('/user/edit');
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ class UserDataController extends Controller
|
|||
$rules['accepted_active'] = 'required';
|
||||
}
|
||||
|
||||
if(Input::get('company') == 1){
|
||||
if(Request::get('company') == 1){
|
||||
$rules['company_name'] = 'required|max:255';
|
||||
$rules['company_country_id'] = 'required|integer|min:1';
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ class UserDataController extends Controller
|
|||
'user' => $user,
|
||||
];
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class UserDataController extends Controller
|
|||
return view('user.edit', $data)->withErrors($validator);
|
||||
|
||||
} else {
|
||||
$this->userRepo->update(Input::all());
|
||||
$this->userRepo->update(Request::all());
|
||||
|
||||
if($user->active == 0) {
|
||||
$account = $user->account;
|
||||
|
|
@ -134,7 +134,7 @@ class UserDataController extends Controller
|
|||
$user->save();
|
||||
}
|
||||
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
if(Request::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else{
|
||||
$user->agreement = null;
|
||||
|
|
@ -152,7 +152,7 @@ class UserDataController extends Controller
|
|||
public function userDataAcceptedForm(){
|
||||
$user = Auth::user();
|
||||
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
if(Request::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else {
|
||||
$user->agreement = null;
|
||||
|
|
@ -189,7 +189,7 @@ class UserDataController extends Controller
|
|||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
// get the error messages from the validator
|
||||
|
|
@ -201,7 +201,7 @@ class UserDataController extends Controller
|
|||
$account->data_protection = now();
|
||||
$account->save();
|
||||
|
||||
if(Input::get('accepted_active') == "on"){
|
||||
if(Request::get('accepted_active') == "on"){
|
||||
$user->agreement = now();
|
||||
}else{
|
||||
$user->agreement = null;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Auth;
|
||||
use Validator;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Repositories\UserRepository;
|
||||
|
||||
|
|
@ -53,7 +52,7 @@ class UserDeleteController extends Controller
|
|||
|
||||
});
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Attribute;
|
||||
use App\Models\ProductAttribute;
|
||||
use App\Models\UserLevel;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
|
||||
class UserLevelController extends Controller
|
||||
|
|
@ -30,7 +30,7 @@ class UserLevelController extends Controller
|
|||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = UserLevel::create([
|
||||
'name' => $data['name'],
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use App\Models\UserShopOnSite;
|
|||
use App\Repositories\UserRepository;
|
||||
use Auth;
|
||||
use Cviebrock\EloquentSluggable\Services\SlugService;
|
||||
use Input;
|
||||
use Request;
|
||||
use Response;
|
||||
use Validator;
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ class UserShopController extends Controller
|
|||
public function store()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
if (!$user->shop) {
|
||||
abort(404);
|
||||
|
|
@ -182,7 +182,7 @@ class UserShopController extends Controller
|
|||
public function uploadOnSiteImage(){
|
||||
|
||||
$user = Auth::user();
|
||||
$user_shop_id = Input::get('user_shop_id');
|
||||
$user_shop_id = Request::get('user_shop_id');
|
||||
|
||||
if(!$user->shop || $user->shop->id != $user_shop_id){
|
||||
abort(404);
|
||||
|
|
@ -268,7 +268,7 @@ class UserShopController extends Controller
|
|||
public function userShopRegisterForm(){
|
||||
|
||||
|
||||
if(Input::get('shop_submit') == 'check'){
|
||||
if(Request::get('shop_submit') == 'check'){
|
||||
$rules = array(
|
||||
'user_shop_name' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|full_word_check',
|
||||
);
|
||||
|
|
@ -278,17 +278,17 @@ class UserShopController extends Controller
|
|||
}
|
||||
return true;
|
||||
});
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('shop-name-error', 'error');
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
return redirect()->back()->withErrors($validator)->withRequest();
|
||||
}
|
||||
\Session()->flash('shop-name-error', 'check');
|
||||
return redirect(route('user_shop'))->withInput();
|
||||
return redirect(route('user_shop'))->withRequest();
|
||||
}
|
||||
|
||||
if(Input::get('shop_submit') == 'action') {
|
||||
if(Request::get('shop_submit') == 'action') {
|
||||
|
||||
$rules = array(
|
||||
'user_shop_name' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|full_word_check',
|
||||
|
|
@ -299,7 +299,7 @@ class UserShopController extends Controller
|
|||
}
|
||||
return true;
|
||||
});
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('shop-name-error', 'error');
|
||||
|
|
@ -311,14 +311,14 @@ class UserShopController extends Controller
|
|||
$rules = array(
|
||||
'user_shop_active' => 'accepted',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
return redirect()->back()->withErrors($validator)->withRequest();
|
||||
}
|
||||
|
||||
//all is right - save
|
||||
$user = Auth::user();
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
|
||||
$user_shop = UserShop::create([
|
||||
'user_id' => $user->id,
|
||||
|
|
@ -387,7 +387,7 @@ class UserShopController extends Controller
|
|||
return true;
|
||||
});
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//$messages = $validator->messages();
|
||||
|
|
@ -397,7 +397,7 @@ class UserShopController extends Controller
|
|||
|
||||
));
|
||||
}
|
||||
$slug = SlugService::createSlug(UserShop::class, 'slug', Input::get('user_shop_name'));
|
||||
$slug = SlugService::createSlug(UserShop::class, 'slug', Request::get('user_shop_name'));
|
||||
|
||||
return Response::json(array(
|
||||
'success' => true,
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ namespace App\Http\Controllers;
|
|||
use App\User;
|
||||
use Auth;
|
||||
use Validator;
|
||||
use Input;
|
||||
use Request;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailActivateUser;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
|
@ -52,7 +50,7 @@ class UserUpdateEmailController extends Controller
|
|||
return true;
|
||||
|
||||
});
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
// redirect our user back to the form with the errors from the validator
|
||||
$messages = $validator->messages();
|
||||
|
|
@ -61,8 +59,7 @@ class UserUpdateEmailController extends Controller
|
|||
|
||||
|
||||
}else{
|
||||
|
||||
$this->sendActivationMail($user, $request->all());
|
||||
$this->sendActivationMail($user, Request::all());
|
||||
\Session()->flash('alert-success', __('We sent you an activation code. Check your email!'));
|
||||
return redirect(route('user_update_email'));
|
||||
}
|
||||
|
|
@ -104,7 +101,7 @@ class UserUpdateEmailController extends Controller
|
|||
return true;
|
||||
|
||||
});
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
// redirect our user back to the form with the errors from the validator
|
||||
$messages = $validator->messages();
|
||||
|
|
@ -114,7 +111,7 @@ class UserUpdateEmailController extends Controller
|
|||
|
||||
}else{
|
||||
|
||||
$this->sendActivationMail($user, $request->all());
|
||||
$this->sendActivationMail($user, Request::all());
|
||||
\Session()->flash('alert-success', __('An activation code was sent to the account by e-mail!'));
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ namespace App\Http\Controllers;
|
|||
use Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Validator;
|
||||
use Input;
|
||||
use Illuminate\Http\Request;
|
||||
use Request;
|
||||
|
||||
|
||||
class UserUpdatePasswordController extends Controller
|
||||
|
|
@ -45,7 +44,7 @@ class UserUpdatePasswordController extends Controller
|
|||
|
||||
});
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
|
|
@ -87,7 +86,7 @@ class UserUpdatePasswordController extends Controller
|
|||
);
|
||||
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@ namespace App\Http\Controllers\Web;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShoppingInstance;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use Yard;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
class CardController extends Controller
|
||||
{
|
||||
|
|
@ -53,7 +52,7 @@ class CardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Input::get('quantity') ? Input::get('quantity') : 1;
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
|
||||
|
|
@ -66,8 +65,8 @@ class CardController extends Controller
|
|||
|
||||
public function showCard(){
|
||||
|
||||
if(Input::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
if(Request::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Request::get('selected_country'));
|
||||
}else{
|
||||
Yard::instance('shopping')->reCalculateShippingPrice();
|
||||
}
|
||||
|
|
@ -79,7 +78,7 @@ class CardController extends Controller
|
|||
|
||||
public function updateCard(){
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
if(isset($data['quantity'])){
|
||||
foreach ($data['quantity'] as $rowId => $qty){
|
||||
Yard::instance('shopping')->update($rowId, $qty);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Illuminate\Support\Collection;
|
|||
use Validator;
|
||||
use App\Services\Util;
|
||||
use Yard;
|
||||
use Input;
|
||||
use Request;
|
||||
|
||||
class CheckoutController extends Controller
|
||||
{
|
||||
|
|
@ -39,8 +39,8 @@ class CheckoutController extends Controller
|
|||
|
||||
// $user_shop = Util::getUserShop();
|
||||
|
||||
if(Input::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
if(Request::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Request::get('selected_country'));
|
||||
}else{
|
||||
// $ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
// $selected_country = $ShippingCountry->id;
|
||||
|
|
@ -107,7 +107,7 @@ class CheckoutController extends Controller
|
|||
'accepted_data_checkbox' => 'accepted',
|
||||
);
|
||||
|
||||
if(!Input::get('same_as_billing')){
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
|
|
@ -118,24 +118,26 @@ class CheckoutController extends Controller
|
|||
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
//make User
|
||||
$shopping_user = $this->makeShoppingUser($data);
|
||||
//make Order and Items
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user);
|
||||
//CustomerPriority
|
||||
CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
|
||||
Util::setUserHistoryValue(['status'=>2, 'shopping_order_id'=>$shopping_order->id]);
|
||||
|
||||
//check credit Card
|
||||
if(Input::get('payment_method')){
|
||||
if(Request::get('payment_method')){
|
||||
|
||||
$ret = [];
|
||||
//need precheck the card
|
||||
if(Input::get('payment_method') === 'cc'){
|
||||
if(Request::get('payment_method') === 'cc'){
|
||||
$pay = new PayoneController();
|
||||
$pay->init($shopping_user, $shopping_order);
|
||||
$ret['cc'] = $pay->checkCreditCard($data);
|
||||
|
|
@ -151,7 +153,7 @@ class CheckoutController extends Controller
|
|||
\Session::flash('cc-error', 1);
|
||||
\Session::flash('errormessage', $ret['cc']['errormessage']);
|
||||
\Session::flash('customermessage', $ret['cc']['customermessage']);
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Request::all());
|
||||
}
|
||||
if($ret['cc']['status'] === 'VALID'){
|
||||
/*
|
||||
|
|
@ -163,10 +165,10 @@ class CheckoutController extends Controller
|
|||
}
|
||||
|
||||
//need precheck the card
|
||||
if(Input::get('payment_method') === 'elv' && is_null(Input::get('mandate_identification'))){
|
||||
if(Request::get('payment_method') === 'elv' && is_null(Request::get('mandate_identification'))){
|
||||
$pay = new PayoneController();
|
||||
$pay->init($shopping_user, $shopping_order);
|
||||
$amount = (int) (float) Yard::instance('shopping')->totalWithShipping(2, '.', ',') *100;
|
||||
$amount = (int) (float) Yard::instance('shopping')->totalWithShipping(2, '.', '') *100;
|
||||
$ret['elv'] = $pay->checkBankAccount($data, $amount, 'EUR', $shopping_user);
|
||||
|
||||
if($ret['elv']['status'] === 'ERROR' || $ret['elv']['status'] === 'INVALID'){
|
||||
|
|
@ -181,14 +183,14 @@ class CheckoutController extends Controller
|
|||
\Session::flash('elv-error', 1);
|
||||
\Session::flash('errormessage', $ret['elv']['errormessage']);
|
||||
\Session::flash('customermessage', $ret['elv']['customermessage']);
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Request::all());
|
||||
}
|
||||
if($ret['elv']['status'] === 'APPROVED' && $ret['elv']['mandate_status'] !== "active"){
|
||||
\Session::flash('elv-managemandate', 1);
|
||||
\Session::flash('elv-mandate_identification', $ret['elv']['mandate_identification']);
|
||||
\Session::flash('elv-mandate_text', $ret['elv']['mandate_text']);
|
||||
\Session::flash('elv-creditor_identifier', $ret['elv']['creditor_identifier']);
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
|
||||
return redirect(route('checkout.checkout_card'))->withInput(Request::all());
|
||||
|
||||
/*
|
||||
* array(4) { ["status"]=> string(5) "VALID" ["pseudocardpan"]=> string(19) "9410010000169020567" ["cardtype"]=> string(1) "V" ["truncatedcardpan"]=> string(16) "411111XXXXXX1111" }
|
||||
|
|
@ -199,9 +201,9 @@ class CheckoutController extends Controller
|
|||
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
|
||||
|
||||
}
|
||||
if(Input::get('payment_method') === 'elv' && Input::get('mandate_identification')) {
|
||||
$ret['elv']['mandate_identification'] = Input::get('mandate_identification');
|
||||
$ret['elv']['creditor_identifier'] = Input::get('creditor_identifier');
|
||||
if(Request::get('payment_method') === 'elv' && Request::get('mandate_identification')) {
|
||||
$ret['elv']['mandate_identification'] = Request::get('mandate_identification');
|
||||
$ret['elv']['creditor_identifier'] = Request::get('creditor_identifier');
|
||||
$ret['elv']['iban'] = $data['elv_iban'];
|
||||
$ret['elv']['bic'] = $data['elv_bic'];
|
||||
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
|
||||
|
|
@ -212,8 +214,8 @@ class CheckoutController extends Controller
|
|||
//other
|
||||
$pay = new PayoneController();
|
||||
$pay->init($shopping_user, $shopping_order);
|
||||
$amount = (int) (float) Yard::instance('shopping')->totalWithShipping(2, '.', ',') *100;
|
||||
$reference = $pay->setPrePayment(Input::get('payment_method'), $amount, 'EUR', $ret);
|
||||
$amount = (int) (float) Yard::instance('shopping')->totalWithShipping(2, '.', '') * 100;
|
||||
$reference = $pay->setPrePayment(Request::get('payment_method'), $amount, 'EUR', $ret);
|
||||
$this->putPayments('payment_reference', $reference);
|
||||
$pay->setPersonalData();
|
||||
return $pay->ResponseData();
|
||||
|
|
@ -297,6 +299,8 @@ class CheckoutController extends Controller
|
|||
|
||||
private function makeShoppingUser($data){
|
||||
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['accepted_data_checkbox'] = isset($data['accepted_data_checkbox']) ? true : false;
|
||||
|
||||
|
|
@ -311,8 +315,6 @@ class CheckoutController extends Controller
|
|||
if(!$shopping_user){
|
||||
$shopping_user = ShoppingUser::create($data);
|
||||
}
|
||||
//CustomerPriority
|
||||
CustomerPriority::checkOne($shopping_user, true);
|
||||
$this->putPayments('shopping_user_id', $shopping_user->id);
|
||||
|
||||
return $shopping_user;
|
||||
|
|
@ -328,12 +330,12 @@ class CheckoutController extends Controller
|
|||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment_for' => Util::getUserPaymentFor(),
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ','),
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ''),
|
||||
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
|
||||
'subtotal' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ','),
|
||||
'subtotal' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
|
||||
'tax_rate' => Yard::getTaxRate(),
|
||||
'tax' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ','),
|
||||
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ','),
|
||||
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
|
||||
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
|
||||
'weight' => Yard::instance('shopping')->weight(),
|
||||
'mode' => Util::getUserShoppingMode(),
|
||||
];
|
||||
|
|
@ -353,7 +355,6 @@ class CheckoutController extends Controller
|
|||
|
||||
$items = Yard::instance('shopping')->content();
|
||||
|
||||
|
||||
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order) {
|
||||
foreach ($items as $item) {
|
||||
if ($model->row_id === $item->rowId) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace App\Http\Controllers\Web;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailContact;
|
||||
use GuzzleHttp\Client;
|
||||
use Input;
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\Util;
|
||||
use Validator;
|
||||
|
|
@ -54,19 +54,19 @@ class ContactController extends Controller
|
|||
return $this->reCaptcha_validate($attribute, $value, $parameters, $validator);
|
||||
});
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
|
||||
$contact = [];
|
||||
$contact['first_name'] = Input::get('first_name');
|
||||
$contact['last_name'] = Input::get('last_name');
|
||||
$contact['email'] = Input::get('email');
|
||||
$contact['phone'] = Input::get('phone');
|
||||
$contact['subject'] = Input::get('subject');
|
||||
$contact['message'] = Input::get('message');
|
||||
$contact['first_name'] = Request::get('first_name');
|
||||
$contact['last_name'] = Request::get('last_name');
|
||||
$contact['email'] = Request::get('email');
|
||||
$contact['phone'] = Request::get('phone');
|
||||
$contact['subject'] = Request::get('subject');
|
||||
$contact['message'] = Request::get('message');
|
||||
|
||||
$checkout_mail = config('app.checkout_mail');
|
||||
if($user_shop){
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use App\Repositories\UserRepository;
|
|||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Input;
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\Util;
|
||||
use Validator;
|
||||
|
|
@ -82,14 +82,14 @@ class RegisterController extends Controller
|
|||
return $this->reCaptcha_validate($attribute, $value, $parameters, $validator);
|
||||
});*/
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
$data = Input::all();
|
||||
$data = Request::all();
|
||||
$user = $this->userRepo->create($data);
|
||||
|
||||
$confirmation_code = UserService::createConfirmationCode();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\Category;
|
||||
use App\Models\IqSite;
|
||||
use App\Models\Product;
|
||||
use Input;
|
||||
use App\Services\Util;
|
||||
|
||||
class SiteController extends Controller
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use App\User;
|
|||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Input;
|
||||
use Request;
|
||||
use Validator;
|
||||
use Yard;
|
||||
|
|
@ -154,7 +153,7 @@ class WizardController extends Controller
|
|||
'accepted_active' => 'required',
|
||||
'accepted_contract' => 'required'
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
|
|
@ -196,7 +195,7 @@ class WizardController extends Controller
|
|||
'birthday' => 'required',
|
||||
);
|
||||
|
||||
if (!Input::get('same_as_billing')) {
|
||||
if (!Request::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname' => 'required',
|
||||
'shipping_lastname' => 'required',
|
||||
|
|
@ -207,14 +206,14 @@ class WizardController extends Controller
|
|||
'shipping_country_id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$data = Request::all();
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
|
|
@ -222,13 +221,13 @@ class WizardController extends Controller
|
|||
}
|
||||
|
||||
if ($step == 2) {
|
||||
if(Input::get('submit') === 'do'){
|
||||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Ausweis hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
|
|
@ -238,20 +237,20 @@ class WizardController extends Controller
|
|||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'id_card');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
if ($step == 3) {
|
||||
if(Input::get('submit') === 'do'){
|
||||
if(Request::get('submit') === 'do'){
|
||||
$data = Request::all();
|
||||
|
||||
if($data['business_license_choose'] === "now"){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
if($data['business_license_choose'] === "later"){
|
||||
|
|
@ -259,11 +258,11 @@ class WizardController extends Controller
|
|||
}
|
||||
if($data['business_license_choose'] === "non"){
|
||||
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
||||
$validator = Validator::make(Input::all(), []);
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Bitte gib eine Begründung ein, warum Du keinen Gewerbeschein benötigst.'));
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}else{
|
||||
$user->account->setNotice('business_license_reason', $data['non_business_license_reason']);
|
||||
}
|
||||
|
|
@ -279,7 +278,7 @@ class WizardController extends Controller
|
|||
$this->fileRepo->_set('dir', '/'.$user->id.'/verification/');
|
||||
$this->fileRepo->_set('user_id', $user->id);
|
||||
$this->fileRepo->_set('identifier', 'business_license');
|
||||
return $this->fileRepo->uploadFile(Input::all());
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
if ($step == 4) {
|
||||
|
|
@ -316,7 +315,7 @@ class WizardController extends Controller
|
|||
'accepted_data_protection' => 'required',
|
||||
'accepted_active' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
|
|
@ -355,7 +354,7 @@ class WizardController extends Controller
|
|||
$rules = array(
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
);
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
|
|
@ -367,7 +366,7 @@ class WizardController extends Controller
|
|||
}
|
||||
|
||||
$user->fill([
|
||||
'password' => Hash::make(Input::get('password'))
|
||||
'password' => Hash::make(Request::get('password'))
|
||||
])->save();
|
||||
$user->wizard = 12;
|
||||
|
||||
|
|
@ -388,7 +387,7 @@ class WizardController extends Controller
|
|||
'birthday' => 'required',
|
||||
);
|
||||
|
||||
if(!Input::get('same_as_billing')){
|
||||
if(!Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
|
|
@ -399,13 +398,13 @@ class WizardController extends Controller
|
|||
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect(route('wizard_create', [12]))->withErrors($validator)->withInput(Input::all());
|
||||
return redirect(route('wizard_create', [12]))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$data = Input::all();
|
||||
$data['same_as_billing'] = Input::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$data = Request::all();
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$user->account->fill($data)->save();
|
||||
|
||||
$user->wizard = 13;
|
||||
|
|
@ -423,12 +422,12 @@ class WizardController extends Controller
|
|||
|
||||
public function storePayment($step = 0){
|
||||
|
||||
if(Input::get('switchers-package-wizard')){
|
||||
if(Request::get('switchers-package-wizard')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Input::get('switchers-package-wizard'));
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
$showAboOptions = false;
|
||||
if(Input::get('abo_options')){
|
||||
if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
|
|
@ -443,8 +442,8 @@ class WizardController extends Controller
|
|||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
//set onboarding products
|
||||
if(Input::get('products_on_board')){
|
||||
foreach (Input::get('products_on_board') as $product_on_board_id){
|
||||
if(Request::get('products_on_board')){
|
||||
foreach (Request::get('products_on_board') as $product_on_board_id){
|
||||
$product_on_board = Product::find($product_on_board_id);
|
||||
$image = "";
|
||||
if($product_on_board->images->count()){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue