#10 Promotion Modul, Kommentar 2

This commit is contained in:
Kevin Adametz 2021-11-09 18:40:18 +01:00
parent f0da981737
commit c9e1545693
128 changed files with 8194 additions and 637 deletions

View file

@ -34,11 +34,11 @@ class PromotionController extends Controller
public function detail($id){
$user_promotion = PromotionUser::findOrFail($id);
if($user_promotion->user_id != Auth::user()->id){
abort(404);
}
$user_promotion->about_you = !$user_promotion->about_you ? $user_promotion->user->account->about_you : $user_promotion->about_you;
$data = [
'checkPaymentCredit' => $user_promotion->checkPaymentCredit(),
'user_promotion_cart' => PromotionUser::preCalculateCart($user_promotion, 'user_promotion'),
@ -59,7 +59,7 @@ class PromotionController extends Controller
if(isset($data['action']) && $data['action'] === 'save-user-promotion'){
$rules = array(
'name' => 'required',
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.'|min:4|max:20',
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
@ -96,7 +96,7 @@ class PromotionController extends Controller
if(isset($data['action']) && $data['action'] === 'validate_url'){
$rules = array(
//'user_promotion_url' => ' required|alpha_dash|profanity|unique:user_shops,name|min:4|max:20|full_word_check',
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.'|min:4|max:20',
'user_promotion_url' => ' required|alpha_dash|profanity|unique:promotion_users,url,'.\Auth::user()->id.',user_id|min:4|max:20',
);
/*Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
if(in_array($value, config('profanity.full_word_check'))){
@ -119,7 +119,7 @@ class PromotionController extends Controller
return Response::json(array(
'success' => true,
'preview_user_promotion_url' => config('app.promo_url').$name,
'preview_user_promotion_url' => config('app.promo_url')."/".$name,
));
}
if(isset($data['action']) && $data['action'] === 'updateCart'){
@ -130,7 +130,7 @@ class PromotionController extends Controller
if(isset($data['products'])){
$fill['user_promotion_cart'] = PromotionUser::preCalculateCart($data['products'], 'products');
$fill['checkPaymentCredit'] = PromotionUser::preCheckPaymentCredit($fill['user_promotion_cart']);
$fill['checkPaymentCredit'] = PromotionUser::preCheckPaymentCredit($fill['user_promotion_cart'], Auth::user());
}
/*if(isset($data['user_promotion_id']) && $user_promotion = PromotionUser::find($data['user_promotion_id'])){