diff --git a/app/Console/Commands/VipActivate.php b/app/Console/Commands/VipActivate.php new file mode 100644 index 00000000..0ed7b0e8 --- /dev/null +++ b/app/Console/Commands/VipActivate.php @@ -0,0 +1,26 @@ +newQuery() + ->select('id', 'email') + ->whereIn('email', $this->argument('emails')) + ->get(); + + $feature->for($users)->activate('vip'); + + return self::SUCCESS; + } +} diff --git a/app/Console/Commands/VipDeactivate.php b/app/Console/Commands/VipDeactivate.php new file mode 100644 index 00000000..954e31d5 --- /dev/null +++ b/app/Console/Commands/VipDeactivate.php @@ -0,0 +1,26 @@ +newQuery() + ->select('id', 'email') + ->whereIn('email', $this->argument('emails')) + ->get(); + + $feature->for($users)->deactivate('vip'); + + return self::SUCCESS; + } +} diff --git a/app/Console/Commands/VipStatus.php b/app/Console/Commands/VipStatus.php new file mode 100644 index 00000000..be2a89d1 --- /dev/null +++ b/app/Console/Commands/VipStatus.php @@ -0,0 +1,36 @@ +argument('emails'); + + $users = $userModel->newQuery() + ->select('id', 'email') + ->whereIn('email', $emails) + ->get(); + + Feature::for($users)->load('vip'); + + $status = $users->map(function (User $user) { + $user['vip'] = $user->features()->active('vip') ? 'ON' : 'OFF'; + + return $user->toArray(); + }); + + $this->table(['ID', 'Email', 'status'], $status->toArray()); + + return self::SUCCESS; + } +} diff --git a/app/Features/Vip.php b/app/Features/Vip.php new file mode 100644 index 00000000..e4f14197 --- /dev/null +++ b/app/Features/Vip.php @@ -0,0 +1,20 @@ +name = 'vip'; + } + + public function resolve(mixed $scope): bool + { + return false; + } +} diff --git a/app/Http/Controllers/User/Order.php b/app/Http/Controllers/User/Order.php index 5a6a8465..4bac5269 100644 --- a/app/Http/Controllers/User/Order.php +++ b/app/Http/Controllers/User/Order.php @@ -3,21 +3,27 @@ namespace App\Http\Controllers\User; use App\Models\Cart; +use App\Models\User; use Carbon\Carbon; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redirect; +use Laravel\Pennant\Feature; use RealRashid\SweetAlert\Facades\Alert; class Order { - public function store(Request $request): RedirectResponse + public function __invoke(Request $request): RedirectResponse { $cart = Cart::findOrFail($request->cart_id)->with('product')->first(); + /** @var User $user */ + $user = Auth::user(); + $order = new \App\Models\Order(); - $order->user_id = Auth::user()->getAuthIdentifier(); + $order->user_id = $user->getAuthIdentifier(); $order->product_id = $cart->product->id; $order->quantity = $request->quantity; @@ -29,7 +35,19 @@ public function store(Request $request): RedirectResponse } else { $totalPrice = $cart->product->price; } - $order->price = $totalPrice; + + $isVip = Feature::for($user)->active('vip'); + + if ($isVip) { + $order->price = (int)$totalPrice * 0.9; + } else { + $order->price = $totalPrice; + } + + Log::info('VIP User order', [ + 'user' => $user->email, + 'vip' => $isVip, + ]); if ($order->save()) { //cart delete diff --git a/app/Models/User.php b/app/Models/User.php index 7805db35..1eea173b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Pennant\Concerns\HasFeatures; use Spatie\Permission\Traits\HasRoles; /** @@ -27,8 +28,9 @@ class User extends Authenticatable { use HasFactory; - use Notifiable; + use HasFeatures; use HasRoles; + use Notifiable; /** * The attributes that are mass assignable. diff --git a/public/css/admin.css b/public/css/admin.css index ad654323..a416262f 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -12110,173 +12110,173 @@ form.user .btn-user { @-webkit-keyframes noise-anim { 0% { - clip: rect(86px, 9999px, 49px, 0); + clip: rect(78px, 9999px, 15px, 0); } 5% { - clip: rect(73px, 9999px, 4px, 0); + clip: rect(46px, 9999px, 79px, 0); } 10% { - clip: rect(14px, 9999px, 47px, 0); + clip: rect(27px, 9999px, 64px, 0); } 15% { - clip: rect(74px, 9999px, 75px, 0); + clip: rect(29px, 9999px, 62px, 0); } 20% { - clip: rect(37px, 9999px, 43px, 0); + clip: rect(97px, 9999px, 78px, 0); } 25% { - clip: rect(99px, 9999px, 37px, 0); + clip: rect(80px, 9999px, 34px, 0); } 30% { - clip: rect(1px, 9999px, 55px, 0); + clip: rect(80px, 9999px, 91px, 0); } 35% { - clip: rect(10px, 9999px, 8px, 0); + clip: rect(74px, 9999px, 21px, 0); } 40% { - clip: rect(3px, 9999px, 80px, 0); + clip: rect(11px, 9999px, 24px, 0); } 45% { - clip: rect(17px, 9999px, 34px, 0); + clip: rect(59px, 9999px, 13px, 0); } 50% { - clip: rect(85px, 9999px, 15px, 0); + clip: rect(57px, 9999px, 37px, 0); } 55% { - clip: rect(20px, 9999px, 7px, 0); + clip: rect(43px, 9999px, 65px, 0); } 60% { - clip: rect(47px, 9999px, 85px, 0); + clip: rect(12px, 9999px, 28px, 0); } 65% { - clip: rect(49px, 9999px, 95px, 0); + clip: rect(98px, 9999px, 32px, 0); } 70% { - clip: rect(78px, 9999px, 67px, 0); + clip: rect(89px, 9999px, 41px, 0); } 75% { - clip: rect(98px, 9999px, 88px, 0); + clip: rect(35px, 9999px, 30px, 0); } 80% { - clip: rect(85px, 9999px, 98px, 0); + clip: rect(49px, 9999px, 63px, 0); } 85% { - clip: rect(84px, 9999px, 88px, 0); + clip: rect(15px, 9999px, 66px, 0); } 90% { - clip: rect(61px, 9999px, 52px, 0); + clip: rect(31px, 9999px, 30px, 0); } 95% { - clip: rect(73px, 9999px, 7px, 0); + clip: rect(78px, 9999px, 9px, 0); } 100% { - clip: rect(99px, 9999px, 74px, 0); + clip: rect(42px, 9999px, 1px, 0); } } @keyframes noise-anim { 0% { - clip: rect(86px, 9999px, 49px, 0); + clip: rect(78px, 9999px, 15px, 0); } 5% { - clip: rect(73px, 9999px, 4px, 0); + clip: rect(46px, 9999px, 79px, 0); } 10% { - clip: rect(14px, 9999px, 47px, 0); + clip: rect(27px, 9999px, 64px, 0); } 15% { - clip: rect(74px, 9999px, 75px, 0); + clip: rect(29px, 9999px, 62px, 0); } 20% { - clip: rect(37px, 9999px, 43px, 0); + clip: rect(97px, 9999px, 78px, 0); } 25% { - clip: rect(99px, 9999px, 37px, 0); + clip: rect(80px, 9999px, 34px, 0); } 30% { - clip: rect(1px, 9999px, 55px, 0); + clip: rect(80px, 9999px, 91px, 0); } 35% { - clip: rect(10px, 9999px, 8px, 0); + clip: rect(74px, 9999px, 21px, 0); } 40% { - clip: rect(3px, 9999px, 80px, 0); + clip: rect(11px, 9999px, 24px, 0); } 45% { - clip: rect(17px, 9999px, 34px, 0); + clip: rect(59px, 9999px, 13px, 0); } 50% { - clip: rect(85px, 9999px, 15px, 0); + clip: rect(57px, 9999px, 37px, 0); } 55% { - clip: rect(20px, 9999px, 7px, 0); + clip: rect(43px, 9999px, 65px, 0); } 60% { - clip: rect(47px, 9999px, 85px, 0); + clip: rect(12px, 9999px, 28px, 0); } 65% { - clip: rect(49px, 9999px, 95px, 0); + clip: rect(98px, 9999px, 32px, 0); } 70% { - clip: rect(78px, 9999px, 67px, 0); + clip: rect(89px, 9999px, 41px, 0); } 75% { - clip: rect(98px, 9999px, 88px, 0); + clip: rect(35px, 9999px, 30px, 0); } 80% { - clip: rect(85px, 9999px, 98px, 0); + clip: rect(49px, 9999px, 63px, 0); } 85% { - clip: rect(84px, 9999px, 88px, 0); + clip: rect(15px, 9999px, 66px, 0); } 90% { - clip: rect(61px, 9999px, 52px, 0); + clip: rect(31px, 9999px, 30px, 0); } 95% { - clip: rect(73px, 9999px, 7px, 0); + clip: rect(78px, 9999px, 9px, 0); } 100% { - clip: rect(99px, 9999px, 74px, 0); + clip: rect(42px, 9999px, 1px, 0); } } @@ -12295,173 +12295,173 @@ form.user .btn-user { @-webkit-keyframes noise-anim-2 { 0% { - clip: rect(87px, 9999px, 80px, 0); + clip: rect(10px, 9999px, 10px, 0); } 5% { - clip: rect(20px, 9999px, 30px, 0); + clip: rect(54px, 9999px, 54px, 0); } 10% { - clip: rect(23px, 9999px, 49px, 0); + clip: rect(25px, 9999px, 14px, 0); } 15% { - clip: rect(53px, 9999px, 95px, 0); + clip: rect(71px, 9999px, 94px, 0); } 20% { - clip: rect(76px, 9999px, 96px, 0); + clip: rect(51px, 9999px, 52px, 0); } 25% { - clip: rect(94px, 9999px, 8px, 0); + clip: rect(35px, 9999px, 63px, 0); } 30% { - clip: rect(92px, 9999px, 72px, 0); + clip: rect(71px, 9999px, 94px, 0); } 35% { - clip: rect(14px, 9999px, 68px, 0); + clip: rect(6px, 9999px, 95px, 0); } 40% { - clip: rect(14px, 9999px, 52px, 0); + clip: rect(20px, 9999px, 58px, 0); } 45% { - clip: rect(83px, 9999px, 93px, 0); + clip: rect(12px, 9999px, 25px, 0); } 50% { - clip: rect(85px, 9999px, 28px, 0); + clip: rect(5px, 9999px, 33px, 0); } 55% { - clip: rect(13px, 9999px, 76px, 0); + clip: rect(15px, 9999px, 16px, 0); } 60% { - clip: rect(54px, 9999px, 33px, 0); + clip: rect(10px, 9999px, 37px, 0); } 65% { - clip: rect(86px, 9999px, 68px, 0); + clip: rect(27px, 9999px, 90px, 0); } 70% { - clip: rect(55px, 9999px, 90px, 0); + clip: rect(82px, 9999px, 40px, 0); } 75% { - clip: rect(61px, 9999px, 22px, 0); + clip: rect(36px, 9999px, 43px, 0); } 80% { - clip: rect(88px, 9999px, 12px, 0); + clip: rect(77px, 9999px, 41px, 0); } 85% { - clip: rect(75px, 9999px, 44px, 0); + clip: rect(67px, 9999px, 69px, 0); } 90% { - clip: rect(37px, 9999px, 15px, 0); + clip: rect(43px, 9999px, 100px, 0); } 95% { - clip: rect(88px, 9999px, 88px, 0); + clip: rect(91px, 9999px, 26px, 0); } 100% { - clip: rect(61px, 9999px, 71px, 0); + clip: rect(52px, 9999px, 19px, 0); } } @keyframes noise-anim-2 { 0% { - clip: rect(87px, 9999px, 80px, 0); + clip: rect(10px, 9999px, 10px, 0); } 5% { - clip: rect(20px, 9999px, 30px, 0); + clip: rect(54px, 9999px, 54px, 0); } 10% { - clip: rect(23px, 9999px, 49px, 0); + clip: rect(25px, 9999px, 14px, 0); } 15% { - clip: rect(53px, 9999px, 95px, 0); + clip: rect(71px, 9999px, 94px, 0); } 20% { - clip: rect(76px, 9999px, 96px, 0); + clip: rect(51px, 9999px, 52px, 0); } 25% { - clip: rect(94px, 9999px, 8px, 0); + clip: rect(35px, 9999px, 63px, 0); } 30% { - clip: rect(92px, 9999px, 72px, 0); + clip: rect(71px, 9999px, 94px, 0); } 35% { - clip: rect(14px, 9999px, 68px, 0); + clip: rect(6px, 9999px, 95px, 0); } 40% { - clip: rect(14px, 9999px, 52px, 0); + clip: rect(20px, 9999px, 58px, 0); } 45% { - clip: rect(83px, 9999px, 93px, 0); + clip: rect(12px, 9999px, 25px, 0); } 50% { - clip: rect(85px, 9999px, 28px, 0); + clip: rect(5px, 9999px, 33px, 0); } 55% { - clip: rect(13px, 9999px, 76px, 0); + clip: rect(15px, 9999px, 16px, 0); } 60% { - clip: rect(54px, 9999px, 33px, 0); + clip: rect(10px, 9999px, 37px, 0); } 65% { - clip: rect(86px, 9999px, 68px, 0); + clip: rect(27px, 9999px, 90px, 0); } 70% { - clip: rect(55px, 9999px, 90px, 0); + clip: rect(82px, 9999px, 40px, 0); } 75% { - clip: rect(61px, 9999px, 22px, 0); + clip: rect(36px, 9999px, 43px, 0); } 80% { - clip: rect(88px, 9999px, 12px, 0); + clip: rect(77px, 9999px, 41px, 0); } 85% { - clip: rect(75px, 9999px, 44px, 0); + clip: rect(67px, 9999px, 69px, 0); } 90% { - clip: rect(37px, 9999px, 15px, 0); + clip: rect(43px, 9999px, 100px, 0); } 95% { - clip: rect(88px, 9999px, 88px, 0); + clip: rect(91px, 9999px, 26px, 0); } 100% { - clip: rect(61px, 9999px, 71px, 0); + clip: rect(52px, 9999px, 19px, 0); } } diff --git a/public/css/app.css b/public/css/app.css index 9861a3b0..6e566559 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -11141,173 +11141,173 @@ body { @-webkit-keyframes noise-anim { 0% { - clip: rect(37px, 9999px, 33px, 0); + clip: rect(75px, 9999px, 35px, 0); } 5% { - clip: rect(19px, 9999px, 98px, 0); + clip: rect(37px, 9999px, 35px, 0); } 10% { - clip: rect(60px, 9999px, 46px, 0); + clip: rect(42px, 9999px, 92px, 0); } 15% { - clip: rect(45px, 9999px, 48px, 0); + clip: rect(13px, 9999px, 9px, 0); } 20% { - clip: rect(6px, 9999px, 92px, 0); + clip: rect(76px, 9999px, 17px, 0); } 25% { - clip: rect(78px, 9999px, 30px, 0); + clip: rect(85px, 9999px, 32px, 0); } 30% { - clip: rect(47px, 9999px, 12px, 0); + clip: rect(68px, 9999px, 76px, 0); } 35% { - clip: rect(87px, 9999px, 81px, 0); + clip: rect(21px, 9999px, 21px, 0); } 40% { - clip: rect(15px, 9999px, 93px, 0); + clip: rect(46px, 9999px, 44px, 0); } 45% { - clip: rect(23px, 9999px, 42px, 0); + clip: rect(46px, 9999px, 3px, 0); } 50% { - clip: rect(7px, 9999px, 49px, 0); + clip: rect(16px, 9999px, 1px, 0); } 55% { - clip: rect(46px, 9999px, 36px, 0); + clip: rect(82px, 9999px, 77px, 0); } 60% { - clip: rect(55px, 9999px, 11px, 0); + clip: rect(36px, 9999px, 70px, 0); } 65% { - clip: rect(100px, 9999px, 81px, 0); + clip: rect(49px, 9999px, 5px, 0); } 70% { - clip: rect(44px, 9999px, 73px, 0); + clip: rect(67px, 9999px, 11px, 0); } 75% { - clip: rect(92px, 9999px, 59px, 0); + clip: rect(10px, 9999px, 22px, 0); } 80% { - clip: rect(26px, 9999px, 72px, 0); + clip: rect(46px, 9999px, 32px, 0); } 85% { - clip: rect(1px, 9999px, 57px, 0); + clip: rect(49px, 9999px, 32px, 0); } 90% { - clip: rect(13px, 9999px, 34px, 0); + clip: rect(43px, 9999px, 79px, 0); } 95% { - clip: rect(22px, 9999px, 27px, 0); + clip: rect(56px, 9999px, 32px, 0); } 100% { - clip: rect(38px, 9999px, 70px, 0); + clip: rect(63px, 9999px, 31px, 0); } } @keyframes noise-anim { 0% { - clip: rect(37px, 9999px, 33px, 0); + clip: rect(75px, 9999px, 35px, 0); } 5% { - clip: rect(19px, 9999px, 98px, 0); + clip: rect(37px, 9999px, 35px, 0); } 10% { - clip: rect(60px, 9999px, 46px, 0); + clip: rect(42px, 9999px, 92px, 0); } 15% { - clip: rect(45px, 9999px, 48px, 0); + clip: rect(13px, 9999px, 9px, 0); } 20% { - clip: rect(6px, 9999px, 92px, 0); + clip: rect(76px, 9999px, 17px, 0); } 25% { - clip: rect(78px, 9999px, 30px, 0); + clip: rect(85px, 9999px, 32px, 0); } 30% { - clip: rect(47px, 9999px, 12px, 0); + clip: rect(68px, 9999px, 76px, 0); } 35% { - clip: rect(87px, 9999px, 81px, 0); + clip: rect(21px, 9999px, 21px, 0); } 40% { - clip: rect(15px, 9999px, 93px, 0); + clip: rect(46px, 9999px, 44px, 0); } 45% { - clip: rect(23px, 9999px, 42px, 0); + clip: rect(46px, 9999px, 3px, 0); } 50% { - clip: rect(7px, 9999px, 49px, 0); + clip: rect(16px, 9999px, 1px, 0); } 55% { - clip: rect(46px, 9999px, 36px, 0); + clip: rect(82px, 9999px, 77px, 0); } 60% { - clip: rect(55px, 9999px, 11px, 0); + clip: rect(36px, 9999px, 70px, 0); } 65% { - clip: rect(100px, 9999px, 81px, 0); + clip: rect(49px, 9999px, 5px, 0); } 70% { - clip: rect(44px, 9999px, 73px, 0); + clip: rect(67px, 9999px, 11px, 0); } 75% { - clip: rect(92px, 9999px, 59px, 0); + clip: rect(10px, 9999px, 22px, 0); } 80% { - clip: rect(26px, 9999px, 72px, 0); + clip: rect(46px, 9999px, 32px, 0); } 85% { - clip: rect(1px, 9999px, 57px, 0); + clip: rect(49px, 9999px, 32px, 0); } 90% { - clip: rect(13px, 9999px, 34px, 0); + clip: rect(43px, 9999px, 79px, 0); } 95% { - clip: rect(22px, 9999px, 27px, 0); + clip: rect(56px, 9999px, 32px, 0); } 100% { - clip: rect(38px, 9999px, 70px, 0); + clip: rect(63px, 9999px, 31px, 0); } } @@ -11326,173 +11326,173 @@ body { @-webkit-keyframes noise-anim-2 { 0% { - clip: rect(30px, 9999px, 67px, 0); + clip: rect(21px, 9999px, 24px, 0); } 5% { - clip: rect(99px, 9999px, 34px, 0); + clip: rect(51px, 9999px, 58px, 0); } 10% { - clip: rect(84px, 9999px, 99px, 0); + clip: rect(29px, 9999px, 1px, 0); } 15% { - clip: rect(62px, 9999px, 26px, 0); + clip: rect(54px, 9999px, 50px, 0); } 20% { - clip: rect(59px, 9999px, 24px, 0); + clip: rect(27px, 9999px, 35px, 0); } 25% { - clip: rect(97px, 9999px, 24px, 0); + clip: rect(3px, 9999px, 45px, 0); } 30% { - clip: rect(26px, 9999px, 20px, 0); + clip: rect(68px, 9999px, 70px, 0); } 35% { - clip: rect(80px, 9999px, 83px, 0); + clip: rect(96px, 9999px, 14px, 0); } 40% { - clip: rect(72px, 9999px, 6px, 0); + clip: rect(56px, 9999px, 52px, 0); } 45% { - clip: rect(63px, 9999px, 60px, 0); + clip: rect(6px, 9999px, 77px, 0); } 50% { - clip: rect(41px, 9999px, 78px, 0); + clip: rect(83px, 9999px, 20px, 0); } 55% { - clip: rect(7px, 9999px, 15px, 0); + clip: rect(62px, 9999px, 28px, 0); } 60% { - clip: rect(9px, 9999px, 55px, 0); + clip: rect(97px, 9999px, 95px, 0); } 65% { - clip: rect(95px, 9999px, 70px, 0); + clip: rect(8px, 9999px, 59px, 0); } 70% { - clip: rect(9px, 9999px, 33px, 0); + clip: rect(75px, 9999px, 84px, 0); } 75% { - clip: rect(73px, 9999px, 3px, 0); + clip: rect(75px, 9999px, 100px, 0); } 80% { - clip: rect(100px, 9999px, 21px, 0); + clip: rect(33px, 9999px, 25px, 0); } 85% { - clip: rect(16px, 9999px, 52px, 0); + clip: rect(75px, 9999px, 94px, 0); } 90% { - clip: rect(18px, 9999px, 13px, 0); + clip: rect(73px, 9999px, 86px, 0); } 95% { - clip: rect(30px, 9999px, 100px, 0); + clip: rect(91px, 9999px, 2px, 0); } 100% { - clip: rect(85px, 9999px, 82px, 0); + clip: rect(23px, 9999px, 10px, 0); } } @keyframes noise-anim-2 { 0% { - clip: rect(30px, 9999px, 67px, 0); + clip: rect(21px, 9999px, 24px, 0); } 5% { - clip: rect(99px, 9999px, 34px, 0); + clip: rect(51px, 9999px, 58px, 0); } 10% { - clip: rect(84px, 9999px, 99px, 0); + clip: rect(29px, 9999px, 1px, 0); } 15% { - clip: rect(62px, 9999px, 26px, 0); + clip: rect(54px, 9999px, 50px, 0); } 20% { - clip: rect(59px, 9999px, 24px, 0); + clip: rect(27px, 9999px, 35px, 0); } 25% { - clip: rect(97px, 9999px, 24px, 0); + clip: rect(3px, 9999px, 45px, 0); } 30% { - clip: rect(26px, 9999px, 20px, 0); + clip: rect(68px, 9999px, 70px, 0); } 35% { - clip: rect(80px, 9999px, 83px, 0); + clip: rect(96px, 9999px, 14px, 0); } 40% { - clip: rect(72px, 9999px, 6px, 0); + clip: rect(56px, 9999px, 52px, 0); } 45% { - clip: rect(63px, 9999px, 60px, 0); + clip: rect(6px, 9999px, 77px, 0); } 50% { - clip: rect(41px, 9999px, 78px, 0); + clip: rect(83px, 9999px, 20px, 0); } 55% { - clip: rect(7px, 9999px, 15px, 0); + clip: rect(62px, 9999px, 28px, 0); } 60% { - clip: rect(9px, 9999px, 55px, 0); + clip: rect(97px, 9999px, 95px, 0); } 65% { - clip: rect(95px, 9999px, 70px, 0); + clip: rect(8px, 9999px, 59px, 0); } 70% { - clip: rect(9px, 9999px, 33px, 0); + clip: rect(75px, 9999px, 84px, 0); } 75% { - clip: rect(73px, 9999px, 3px, 0); + clip: rect(75px, 9999px, 100px, 0); } 80% { - clip: rect(100px, 9999px, 21px, 0); + clip: rect(33px, 9999px, 25px, 0); } 85% { - clip: rect(16px, 9999px, 52px, 0); + clip: rect(75px, 9999px, 94px, 0); } 90% { - clip: rect(18px, 9999px, 13px, 0); + clip: rect(73px, 9999px, 86px, 0); } 95% { - clip: rect(30px, 9999px, 100px, 0); + clip: rect(91px, 9999px, 2px, 0); } 100% { - clip: rect(85px, 9999px, 82px, 0); + clip: rect(23px, 9999px, 10px, 0); } } diff --git a/public/js/shop.js b/public/js/shop.js index 277a061c..8fe29f8f 100644 --- a/public/js/shop.js +++ b/public/js/shop.js @@ -326,6 +326,10 @@ __webpack_require__.r(__webpack_exports__); // // // +// +// +// +// /* harmony default export */ __webpack_exports__["default"] = ({ name: "my-cart", @@ -1309,6 +1313,17 @@ var render = function() { ]) ]), _vm._v(" "), + _c("h6", [ + _vm._v( + "\n VIP Discount:\n " + ), + _c("span", { staticClass: "text-orange" }, [ + _vm._v( + "Rs. -" + _vm._s(_vm.modalProduct.price * 0.1) + ) + ]) + ]), + _vm._v(" "), _vm._m(3), _vm._v(" "), _c("h6", [ @@ -1318,7 +1333,9 @@ var render = function() { _c("span", { staticClass: "text-orange" }, [ _vm._v( "Rs. " + - _vm._s(Number(_vm.modalProduct.price) + 100) + _vm._s( + Number(_vm.modalProduct.price * 0.9) + 100 + ) ) ]) ]) diff --git a/resources/js/components/MyCart.vue b/resources/js/components/MyCart.vue index 692d0cea..c879a8aa 100644 --- a/resources/js/components/MyCart.vue +++ b/resources/js/components/MyCart.vue @@ -170,6 +170,10 @@ Product price: Rs. {{ modalProduct.price }} +
+ VIP Discount: + Rs. -{{ modalProduct.price * 0.1 }} +
Shipping cost: Rs. 100 @@ -177,7 +181,7 @@
Total shipping fee: Rs. {{ Number(modalProduct.price) + 100 }}Rs. {{ Number(modalProduct.price * 0.9) + 100 }}
@@ -346,4 +350,4 @@ export default { \ No newline at end of file + diff --git a/routes/web.php b/routes/web.php index 54a0e202..8a5bf4fc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,6 +7,7 @@ use App\Http\Controllers\HomeController; use App\Http\Controllers\MyOrderController; use App\Http\Controllers\User\Catalog; +use App\Http\Controllers\User\Order; use App\Http\Controllers\User\Shop; use App\Http\Controllers\User\ShowProduct; use App\Http\Controllers\UserController; @@ -45,7 +46,7 @@ Route::get('/cart/api/all', [CartController::class, 'all']); Route::post('/cart/destroy/selected', [CartController::class, 'destroySelected']); - Route::post('/order', [OrderController::class, 'store']); + Route::post('/order', Order::class); Route::get('/my-order', [MyOrderController::class, 'index'])->name('myOrder.index'); Route::delete('/my-order/{id}', [MyOrderController::class, 'destroy'])->name('myOrder.destroy');