checkout half done

Cette révision appartient à :
mojahidjouel 2023-12-09 11:18:35 +06:00
Parent 78e7b044c1
révision 30b321e5be
7 fichiers modifiés avec 249 ajouts et 165 suppressions

Voir le fichier

@ -6,5 +6,47 @@
class CheckoutController extends Controller
{
//
/**
* Display a listing of the resource.
*/
public function index()
{
return view('frontend.checkout');
}
/**
* Store a newly created resource in storage.
*/
public function store(AddNewRequest $request)
{
try {
$instructor = new Instructor;
$instructor->name_en = $request->fullName_en;
$instructor->name_bn = $request->fullName_bn;
$instructor->contact_en = $request->contactNumber_en;
$instructor->contact_bn = $request->contactNumber_bn;
$instructor->email = $request->emailAddress;
$instructor->role_id = $request->roleId;
$instructor->bio = $request->bio;
$instructor->designation = $request->designation;
$instructor->title = $request->title;
$instructor->status = $request->status;
$instructor->password = Hash::make($request->fullName_bn);
$instructor->language = 'en';
$instructor->access_block = $request->access_block;
if ($request->hasFile('image')) {
$imageName = rand(111, 999) . time() . '.' . $request->image->extension();
$request->image->move(public_path('uploads/instructors'), $imageName);
$instructor->image = $imageName;
}
if ($instructor->save())
return redirect()->route('instructor.index')->with('success', 'Data Saved');
else
return redirect()->back()->withInput()->with('error', 'Please try again');
} catch (Exception $e) {
// dd($e);
return redirect()->back()->withInput()->with('error', 'Please try again');
}
}
}

Voir le fichier

@ -18,20 +18,20 @@ public function signUpForm()
return view('students.auth.register');
}
public function signUpStore(SignUpRequest $request)
public function signUpStore(SignUpRequest $request,$back_route)
{
try {
$student = new Student;
$student->name_en = $request->name;
$student->email = $request->email;
$student->password = Hash::make($request->password);
if ($student->save())
return redirect()->route('studentLogin')->with('success', 'Successfully Registered');
else
return redirect()->route('studentLogin')->with('danger', 'Please Try Again');
if ($student->save()){
$this->setSession($student);
return redirect()->route($back_route)->with('success', 'Successfully Logged In');
}
} catch (Exception $e) {
//dd($e);
return redirect()->route('studentLogin')->with('danger', 'Please Try Again');
return redirect()->back()->with('danger', 'Please Try Again');
}
}
@ -40,7 +40,7 @@ public function signInForm()
return view('students.auth.login');
}
public function signInCheck(SignInRequest $request)
public function signInCheck(SignInRequest $request,$back_route)
{
try {
$student = Student::Where('email', $request->email)->first();
@ -48,16 +48,16 @@ public function signInCheck(SignInRequest $request)
if ($student->status == 1) {
if (Hash::check($request->password, $student->password)) {
$this->setSession($student);
return redirect()->route('studentdashboard')->with('success', 'Successfully Logged In');
return redirect()->route($back_route)->with('success', 'Successfully Logged In');
} else
return redirect()->route('studentLogin')->with('error', 'Username or Password is wrong!');
return redirect()->back()->with('error', 'Username or Password is wrong!');
} else
return redirect()->route('studentLogin')->with('error', 'You are not an active user! Please contact to Authority');
return redirect()->back()->with('error', 'You are not an active user! Please contact to Authority');
} else
return redirect()->route('studentLogin')->with('error', 'Username or Password is wrong!');
return redirect()->back()->with('error', 'Username or Password is wrong!');
} catch (Exception $e) {
//dd($e);
return redirect()->route('studentLogin')->with('error', 'Username or Password is wrong!');
return redirect()->back()->with('error', 'Username or Password is wrong!');
}
}

Voir le fichier

@ -32,9 +32,7 @@
<img src="{{asset('public/uploads/courses/' . $details['image'])}}" alt="course image" />
</div>
<div class="text">
<h6><a
href="{{route('courseDetails', encryptor('encrypt', $id))}}">{{$details['title_en']}}</a>
</h6>
<h6><a href="{{route('courseDetails', encryptor('encrypt', $id))}}">{{$details['title_en']}}</a></h6>
<p>By <a href="#">{{$details['instructor']}}</a></p>
<div class="bottom-wizard d-flex justify-content-between align-items-center">
<p>

Voir le fichier

@ -18,41 +18,12 @@
<!-- Checkout Area Starts Here -->
<section class="section checkout-area">
<div class="container">
@if(request()->session()->get('studentLogin'))
<?php print_r(base64_encode(json_encode(session('cart')))) ?>
<div class="row">
<div class="col-lg-6 checkout-area-checkout">
<h6 class="checkout-area__label">Checkout</h6>
<div class="checkout-tab">
<ul class="nav nav-pills mb-4" id="pills-tab" role="tablist">
<li class="nav-item" role="presentation">
<div class="nav-link active" id="pills-checkout-tab" data-bs-toggle="pill"
data-bs-target="#pills-checkout" role="tab" aria-controls="pills-checkout"
aria-selected="true">
<svg width="45" height="34" viewBox="0 0 45 34" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M39.5 2H5.75C3.67893 2 2 3.67893 2 5.75V28.25C2 30.3211 3.67893 32 5.75 32H39.5C41.5711 32 43.25 30.3211 43.25 28.25V5.75C43.25 3.67893 41.5711 2 39.5 2Z"
stroke="#25252E" stroke-width="3" stroke-linecap="round"
stroke-linejoin="round"></path>
<path d="M2 13.25H43.25" stroke="#25252E" stroke-width="3" stroke-linecap="round"
stroke-linejoin="round"></path>
</svg>
<h6>Credit Card</h6>
</div>
</li>
<li class="nav-item" role="presentation">
<div class="nav-link" id="pills-paypal-tab" data-bs-toggle="pill"
data-bs-target="#pills-paypal" role="tab" aria-controls="pills-paypal"
aria-selected="false">
<svg width="36" height="36" viewBox="0 0 36 36" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M34.3645 9.87497C33.0578 8.24878 30.9754 7.17195 28.6375 6.87312C27.8964 2.35603 23.9347 0 20.1264 0H6.39971L0 29.25H8.51871L6.99634 36H17.9033L20.0834 27H23.538C26.5049 27 29.2062 26.121 31.3497 24.4579C33.572 22.7336 35.0861 20.2411 35.7285 17.2493C36.5225 13.5456 35.425 11.1949 34.3645 9.87497ZM3.49483 26.4375L8.66386 2.8125H20.1264C22.4738 2.8125 25.0369 4.07637 25.7528 6.82031H13.5775L9.15304 26.4375H3.49483ZM25.8469 9.63281C25.8118 9.91997 25.7669 10.1933 25.712 10.4513C24.7132 15.105 21.6598 17.3672 16.3772 17.3672H14.0823L15.8267 9.63281H25.8469ZM32.978 16.6594C31.9809 21.3029 28.3636 24.1875 23.5379 24.1875H17.8703L15.6903 33.1875H10.5142L13.448 20.1797H16.3772C19.5591 20.1797 22.2011 19.437 24.23 17.9724C26.3853 16.4164 27.8093 14.0844 28.4628 11.0392C28.5512 10.6243 28.6185 10.1835 28.6665 9.72176C30.1258 9.98269 31.3855 10.6581 32.1715 11.6364C33.158 12.8642 33.4294 14.5543 32.978 16.6594Z"
fill="#908FA5"></path>
</svg>
<h6>Paypal</h6>
</div>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-checkout" role="tabpanel"
aria-labelledby="pills-checkout-tab">
@ -93,45 +64,6 @@
Payment</button>
</form>
</div>
<div class="tab-pane fade" id="pills-paypal" role="tabpanel" aria-labelledby="pills-paypal-tab">
<form action="#">
<div class="mb-3">
<label for="card-name-two">Name on Card</label>
<input type="text" class="form-control" placeholder="Type here"
id="card-name-two" />
</div>
<div class="mb-3">
<label for="card-number-two">Card Number</label>
<input type="text" class="form-control" placeholder="Type here"
id="card-number-two" />
</div>
<div class="mb-3">
<div class="row">
<div class="col-md-6 mb-3 mb-lg-0">
<label for="expiration-date-two">Expiration Date (MM/YY)</label>
<input type="text" class="form-control" placeholder="Type here"
id="expiration-date-two" />
</div>
<div class="col-md-6">
<label for="cvc-two">CVC</label>
<input type="text" class="form-control" id="cvc-two"
placeholder="Type here" />
</div>
</div>
</div>
<div class="mb-4">
<div class="form-check d-flex align-items-center ps-0">
<input type="checkbox" id="flexCheckIndeterminate-two" />
<label class="form-check-label ms-2 mb-0" for="flexCheckIndeterminate-two">
Save my information for a faster checkout
</label>
</div>
</div>
<button type="submit" class="button button-lg button--primary w-100">Confirm
Payment</button>
</form>
</div>
</div>
</div>
</div>
@ -142,45 +74,35 @@
<div class="cart">
<div class="cart__includes-info cart__includes-info--bordertop-0">
<div class="productContent__wrapper">
@php $total = 0 @endphp
@if (session('cart'))
@foreach (session('cart') as $id => $details)
@php $total += $details['price'] * $details['quantity'] @endphp
<div class="productContent">
<div class="productContent-item__img productContent-item">
<img src="{{asset('public/frontend/dist/images/checkout/01.jpg')}}" alt="checkout" />
<img src="{{asset('public/uploads/courses/' . $details['image'])}}" alt="checkout" />
</div>
<div class="productContent-item__info productContent-item">
<h6 class="font-para--lg">
<a href="#">Gamification: Motivation Psychology &amp; The
Art of Engagement.</a>
<a href="{{route('courseDetails', encryptor('encrypt', $id))}}">{{$details['title_en']}}</a>
</h6>
<p>by Kevin Gibert</p>
<p>by {{$details['instructor']}}</p>
<div class="price">
<h6 class="font-para--md">$12</h6>
<p><del>$95</del></p>
</div>
</div>
</div>
<div class="productContent">
<div class="productContent-item__img productContent-item">
<img src="{{asset('public/frontend/dist/images/checkout/02.jpg')}}" alt="checkout" />
</div>
<div class="productContent-item__info productContent-item">
<h6 class="font-para--lg">
<a href="#">Digital Art for Beginners - Unleash Your
Creativity</a>
</h6>
<p>by Kevin Gibert</p>
<div class="price">
<h6 class="font-para--md">$12</h6>
<p><del>$95</del></p>
<h6 class="font-para--md">{{$details['price'] ? '$' . $details['price'] : 'Free'}}</h6>
<p><del>{{$details['old_price'] ? '$' . $details['old_price'] : ''}}</del></p>
</div>
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class="cart__checkout-process">
<ul>
<li>
<p>Subtotal</p>
<p>$49.99</p>
<p>{{'$' . number_format((float) $total, 2)}}</p>
</li>
<li>
<p>Coupon Discount</p>
@ -192,7 +114,7 @@
</li>
<li>
<p class="font-title--card">Total:</p>
<p class="total-price font-title--card">$36.49</p>
<p class="total-price font-title--card">{{'$' . number_format((float) $total, 2)}}</p>
</li>
</ul>
</div>
@ -200,8 +122,148 @@
</div>
</div>
</div>
@else
<!-- SignIn Area Starts Here -->
<section class="section signin overflow-hidden">
<div class="container">
<div class="row align-items-center">
<div class="col-xl-6 offset-xl-3 order-2 order-xl-0">
<div class="signup-area-textwrapper">
<h2 class="font-title--md mb-0">Sign in Before Checkout</h2>
<p class="mt-2 mb-lg-4 mb-3">Don't have account?
<a href="#" onclick="hide_signin()" class="text-black-50">Sign up</a>
</p>
<form action="{{route('studentLogin.check','checkout')}}" method="POST">
@csrf
<div class="form-element">
<label for="email">Email</label>
<input type="email" placeholder="Username" id="email" name="email" />
@if($errors->has('email'))
<small class="d-block text-danger">{{$errors->first('email')}}</small>
@endif
</div>
<div class="form-element">
<div class="d-flex justify-content-between">
<label for="password">Password</label>
<a href="forget-password.html" class="text-primary fs-6">Forget Password</a>
</div>
<div class="form-alert-input">
<input type="password" placeholder="Type here..." id="password" name="password" />
<div class="form-alert-icon" onclick="showPassword('password',this);">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="feather feather-eye">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</div>
@if($errors->has('password'))
<small class="d-block text-danger">{{$errors->first('password')}}</small>
@endif
</div>
</div>
<div class="form-element">
<button type="submit" class="button button-lg button--primary w-100">Sign in</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- SignIn Area Ends Here -->
<!-- SignUp Area Starts Here -->
<section class="signup" style="display:none">
<div class="container">
<div class="row align-items-center justify-content-md-center">
<div class="col-lg-5 order-2 order-lg-0">
<div class="signup-area-textwrapper">
<h2 class="font-title--md mb-0">Sign Up Before Checkout</h2>
<p class="mt-2 mb-lg-4 mb-3">Already have account? <a href="#" onclick="hide_signin()" class="text-black-50">Sign In</a></p>
<form action="{{route('studentRegister.store','checkout')}}" method="POST">
@csrf
<div class="form-element">
<label for="name">Full Name</label>
<input type="text" placeholder="Enter Your Name" id="name" value="{{old('name')}}" name="name" />
@if($errors->has('name'))
<small class="d-block text-danger">{{$errors->first('name')}}</small>
@endif
</div>
<div class="form-element">
<label for="email">Email</label>
<input type="email" placeholder="example@email.com" id="email" value="{{old('email')}}" name="email" />
@if($errors->has('email'))
<small class="d-block text-danger">{{$errors->first('email')}}</small>
@endif
</div>
<div class="form-element">
<label for="password" class="w-100" style="text-align: left;">password</label>
<div class="form-alert-input">
<input type="password" placeholder="Type here..." id="password" name="password"/>
<div class="form-alert-icon" onclick="showPassword('password',this)">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="feather feather-eye">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</div>
@if($errors->has('password'))
<small class="d-block text-danger">{{$errors->first('password')}}</small>
@endif
</div>
</div>
<div class="form-element">
<label for="password_confirmation" class="w-100" style="text-align: left;">Confirm
password</label>
<div class="form-alert-input">
<input type="password" placeholder="Type here..." name="password_confirmation" id="password_confirmation" />
<div class="form-alert-icon" onclick="showPassword('password_confirmation',this)">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="feather feather-eye">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</div>
</div>
</div>
<div class="form-element d-flex align-items-center terms">
<input class="checkbox-primary me-1" type="checkbox" id="agree" />
<label for="agree" class="text-secondary mb-0">Accept the <a href="#"
style="text-decoration: underline;">Terms</a> and <a href="#"
style="text-decoration: underline;">Privacy Policy</a></label>
</div>
<div class="form-element">
<button type="submit" class="button button-lg button--primary w-100">Sign UP</button>
</div>
</form>
</div>
</div>
<div class="col-lg-7 order-1 order-lg-0">
<div class="signup-area-image">
<img src="{{asset('public/frontend/dist/images/signup/Illustration.png')}}" alt="Illustration Image"
class="img-fluid" />
</div>
</div>
</div>
</div>
</section>
<!-- SignUp Area Ends Here -->
@endif
</div>
</section>
<!-- Checkout Area Ends Here -->
@endsection
@push('scripts')
<script>
function hide_signin(){
$('.signin').toggle();
$('.signup').toggle();
}
</script>
@endpush

Voir le fichier

@ -11,7 +11,7 @@
<p class="mt-2 mb-lg-4 mb-3">Don't have account? <a href="{{route('studentRegister')}}"
class="text-black-50">Sign
up</a></p>
<form action="{{route('studentLogin.check')}}" method="POST">
<form action="{{route('studentLogin.check','studentdashboard')}}" method="POST">
@csrf
<div class="form-element">
<label for="email">Email</label>
@ -60,13 +60,4 @@ class="img-fluid" />
</div>
</section>
<!-- SignIn Area Ends Here -->
<!-- Dot Images Starts Here -->
<div class="dot-images">
<img src="{{asset('public/frontend/dist/images/shape/dots/dots-img-10.png')}}" alt="shape" style="z-index: 1;"
class="img-fluid first-dotimage" />
<img src="{{asset('public/frontend/dist/images/shape/dots/dots-img-07.png')}}" alt="shape"
class="img-fluid second-dotimage" />
</div>
<!-- Dot Images Ends Here -->
@endsection

Voir le fichier

@ -8,9 +8,8 @@
<div class="col-lg-5 order-2 order-lg-0">
<div class="signup-area-textwrapper">
<h2 class="font-title--md mb-0">Sign Up</h2>
<p class="mt-2 mb-lg-4 mb-3">Already have account? <a href="{{route('studentLogin')}}" class="text-black-50">Sign
In</a></p>
<form action="{{route('studentRegister.store')}}" method="POST">
<p class="mt-2 mb-lg-4 mb-3">Already have account? <a href="{{route('studentLogin')}}" class="text-black-50">Sign In</a></p>
<form action="{{route('studentRegister.store','studentdashboard')}}" method="POST">
@csrf
<div class="form-element">
<label for="name">Full Name</label>
@ -81,12 +80,4 @@ class="img-fluid" />
</section>
<!-- SignUp Area Ends Here -->
<!-- Dot Images Starts Here -->
<div class="dot-images">
<img src="{{asset('public/frontend/dist/images/shape/dots/dots-img-05.png')}}" alt="shape"
class="img-fluid first-dotimage" />
<img src="{{asset('public/frontend/dist/images/shape/dots/dots-img-07.png')}}" alt="shape"
class="img-fluid second-dotimage" />
</div>
<!-- Dot Images Ends Here -->
@endsection

Voir le fichier

@ -20,6 +20,7 @@
use App\Http\Controllers\Backend\Communication\MessageController as message;
use App\Http\Controllers\CartController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\CheckoutController;
/* students */
use App\Http\Controllers\Students\AuthController as sauth;
@ -69,9 +70,9 @@
/* students controllers */
Route::get('/student/register', [sauth::class, 'signUpForm'])->name('studentRegister');
Route::post('/student/register', [sauth::class, 'signUpStore'])->name('studentRegister.store');
Route::post('/student/register/{back_route}', [sauth::class, 'signUpStore'])->name('studentRegister.store');
Route::get('/student/login', [sauth::class, 'signInForm'])->name('studentLogin');
Route::post('/student/login', [sauth::class, 'signInCheck'])->name('studentLogin.check');
Route::post('/student/login/{back_route}', [sauth::class, 'signInCheck'])->name('studentLogin.check');
Route::get('/student/logout', [sauth::class, 'signOut'])->name('studentlogOut');
Route::middleware(['checkstudent'])->prefix('students')->group(function () {
@ -112,6 +113,8 @@
// })->name('instructorProfile');
Route::get('instructorProfile/{id}', [instructor::class, 'frontShow'])->name('instructorProfile');
Route::get('checkout', [CheckoutController::class, 'index'])->name('checkout');
Route::post('checkout', [CheckoutController::class, 'store'])->name('checkout.store');
@ -119,9 +122,6 @@
return view('frontend.cart');
})->name('cart');
Route::get('/checkout', function () {
return view('frontend.checkout');
})->name('checkout');
Route::get('/contact', function () {
return view('frontend.contact');