diff --git a/app/Http/Controllers/front/PromoCodeController.php b/app/Http/Controllers/front/PromoCodeController.php index 28f6cb7..25dc552 100644 --- a/app/Http/Controllers/front/PromoCodeController.php +++ b/app/Http/Controllers/front/PromoCodeController.php @@ -5,6 +5,7 @@ use App\Models\Promocode; use Auth; use Illuminate\Http\Request; +use Exception; class PromoCodeController extends Controller { @@ -22,28 +23,58 @@ public function index() public function create() { $user_id = Auth::guard('member')->user()->id; - $count = Promocode::where('used_count', $user_id)->count(); + $count = Promocode::where('used_count', $user_id)->count(); - if (! $count) { + if (!$count) { - $row = Promocode::where('used_count', 0)->first(); + $row = Promocode::where('used_count', 0)->first(); $row->used_count = $user_id; $row->save(); return response()->json(['status' => 'success', 'msg' => '已成功取得', 'promocode' => $row->code]); } else { - $code = Promocode::where('used_count', $user_id)->first(); + $code = Promocode::where('used_count', $user_id)->latest() + ->first(); + ; return response()->json(['status' => 'success', 'msg' => '你已取得過優惠碼', 'promocode' => $code->code]); } } + /** + * Summary of morePromocode + * @throws \Exception + * @return mixed|\Illuminate\Http\JsonResponse + */ + public function morePromocode() + { + $user = Auth::guard('member')->user(); + + try { + if ($user->level != 9) { + throw new Exception("Error Processing Request", 401); + } else { + + $row = Promocode::where('used_count', 0)->first(); + $row->used_count = $user->id; + $row->save(); + return response()->json(['status' => 'success', 'msg' => '已成功取得', 'promocode' => $row->code]); + } + + + } catch (Exception $th) { + //throw $th; + return response()->json(['status' => 'error', 'msg' => $th->getMessage(), 'code' => $th->getCode()]); + + } + } + /** * Store a newly created resource in storage. */ public function store(Request $request) { - + // } diff --git a/app/Models/Member.php b/app/Models/Member.php index 09f2a3a..fee4564 100644 --- a/app/Models/Member.php +++ b/app/Models/Member.php @@ -64,7 +64,7 @@ public function getLevelNameAttribute() public function getPromoCode() { - return $this->hasOne(Promocode::class, 'used_count', 'id'); + return $this->hasMany(Promocode::class, 'used_count', 'id'); } protected function casts(): array { diff --git a/public/assets/img/favicon/cafeg.ico b/public/assets/img/favicon/cafeg.ico new file mode 100644 index 0000000..90f4ec0 Binary files /dev/null and b/public/assets/img/favicon/cafeg.ico differ diff --git a/public/assets/img/logo/cafeg-logo-1.png b/public/assets/img/logo/cafeg-logo-1.png new file mode 100644 index 0000000..843597b Binary files /dev/null and b/public/assets/img/logo/cafeg-logo-1.png differ diff --git a/resources/views/admin/dashboard/auth-register.blade.php b/resources/views/admin/dashboard/auth-register.blade.php index 7f87651..0f75f46 100644 --- a/resources/views/admin/dashboard/auth-register.blade.php +++ b/resources/views/admin/dashboard/auth-register.blade.php @@ -15,9 +15,10 @@ - - + + + - - + @@ -323,4 +323,4 @@ function validateField(field) { \ No newline at end of file + diff --git a/resources/views/admin/dashboard/profile.blade.php b/resources/views/admin/dashboard/profile.blade.php index b2f672c..b070685 100644 --- a/resources/views/admin/dashboard/profile.blade.php +++ b/resources/views/admin/dashboard/profile.blade.php @@ -15,6 +15,7 @@ + @@ -74,7 +75,7 @@ // Core stylesheets 'core.scss': 'https://demos.pixinvent.com/materialize-html-laravel-admin-template/demo/build/assets/core-kL5gEEKA.css', 'core-dark.scss': 'https://demos.pixinvent.com/materialize-html-laravel-admin-template/demo/build/assets/core-dark-DFvmi5J3.css', - + // Themes 'theme-default.scss': 'https://demos.pixinvent.com/materialize-html-laravel-admin-template/demo/build/assets/theme-default-Bt2z4DrM.css', 'theme-default-dark.scss': 'https://demos.pixinvent.com/materialize-html-laravel-admin-template/demo/build/assets/theme-default-dark-CHvAJUy2.css', @@ -95,7 +96,7 @@ - +
@@ -107,13 +108,13 @@ @@ -178,7 +179,7 @@ class="form-control" placeholder="密碼" aria-label="密碼" value="{{$data->password ?? ''}}" - + />
請輸入有效密碼
@@ -208,7 +209,7 @@ class="form-control" placeholder="確認密碼" aria-label="確認密碼" value="{{$data->password ?? ''}}" - + />
密碼與確認密碼不相符
@@ -249,7 +250,7 @@ class="form-control phone-number-mask"
- +
diff --git a/resources/views/admin/member/index.blade.php b/resources/views/admin/member/index.blade.php index b228a29..05d5386 100644 --- a/resources/views/admin/member/index.blade.php +++ b/resources/views/admin/member/index.blade.php @@ -2,6 +2,29 @@ @section('header') @endsection @section('content') +
@@ -165,12 +188,39 @@ class="rounded-circle"> @elseif($item->level == 2) + @elseif($item->level == 9) + @endif {{ $item->Level_Name }} - {{ $item->getPromoCode->code }} + + @if (count($item->getPromoCode) == 1) + + + {{ $item->getPromoCode[0]->code }} + + @endif + @if (count($item->getPromoCode) > 1) + + @endif +
+
+ + @foreach ($item->getPromoCode as $key => $val) + @if($key %8 ==0) +
+ @endif + {{ $val->code }} + @endforeach +
+
+
+ @@ -186,6 +236,12 @@ class="rounded-circle">
+
@endsection @section('scripts') diff --git a/resources/views/admin/setting/adminlist.blade.php b/resources/views/admin/setting/adminlist.blade.php index 259f1af..a5e4614 100644 --- a/resources/views/admin/setting/adminlist.blade.php +++ b/resources/views/admin/setting/adminlist.blade.php @@ -167,13 +167,12 @@ {{ $item->phone }} - - + + @@ -183,7 +182,15 @@ class="badge rounded-pill {{ $item->can_login == 1 ? 'bg-label-primary' : 'bg-la
+
+
+
{{ $data->links() }} @@ -195,41 +202,42 @@ class="badge rounded-pill {{ $item->can_login == 1 ? 'bg-label-primary' : 'bg-la @endsection @section('scripts') @endsection diff --git a/resources/views/front/auth/confirmpassword.blade.php b/resources/views/front/auth/confirmpassword.blade.php index eaa72f2..ab95758 100644 --- a/resources/views/front/auth/confirmpassword.blade.php +++ b/resources/views/front/auth/confirmpassword.blade.php @@ -78,9 +78,9 @@
-
- @@ -121,7 +109,7 @@

歡迎來到卡菲姬 👋

請登入後逕行兌換飲品,希望您會喜歡

-
+ @csrf
@@ -156,7 +144,7 @@

新的裝置? - + 創建新的帳號

@@ -167,12 +155,12 @@ @@ -195,36 +183,36 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + {{-- --}} {{-- --}} - - + + - - + + - - + + - + @@ -254,8 +242,7 @@ }); }); - - @endif + @endif diff --git a/resources/views/front/member/auth-register.blade.php b/resources/views/front/member/auth-register.blade.php index 3e95f2d..a1bcdda 100644 --- a/resources/views/front/member/auth-register.blade.php +++ b/resources/views/front/member/auth-register.blade.php @@ -15,8 +15,8 @@ - + diff --git a/resources/views/front/member/index.blade.php b/resources/views/front/member/index.blade.php index 8a79466..52dffba 100644 --- a/resources/views/front/member/index.blade.php +++ b/resources/views/front/member/index.blade.php @@ -1,202 +1,287 @@ @extends('layouts.app') @section('content') + - .table { - width: 100%; - /* 撐滿父容器 */ - } + - + +
- + +
- -
- - -
- - -
-
-
- -