I've got a project from Github and I want to modify it. I'm trying to remove the stripe payment, so the registration is done without the payment gateway. I'm working with Laravel.
For the routes,
Route::post('course/payment', ['uses' => 'CoursesController@payment', 'as' => 'courses.payment']);
For the controller method,
public function payment(Request $request)
{
$course = Course::findOrFail($request->get('course_id'));
$this->createStripeCharge($request);
$course->students()->attach(\Auth::id());
return redirect()->back()->with('success', 'Payment completed successfully.');
}
The form action in the blade.php file is:
@if (\Auth::check())
@if ($course->students()->where('user_id', \Auth::id())->count() == 0)
<form action="{{ route('courses.payment') }}" method="POST">
<input type="hidden" name="course_id" value="{{ $course->id }}" />
<input type="hidden" name="amount" value="{{ $course->price * 100 }}" />
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="{{ env('PUB_STRIPE_API_KEY') }}"
data-amount="{{ $course->price * 100 }}"
data-currency="usd"
data-name="LMS"
data-label="Buy this course (${{ $course->price }})"
data-description="Course: {{ $course->title }}"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-zip-code="false">
</script>
{{ csrf_field() }}
</form>
@endif
@else
I know I'm supposed to get it to a GET
method, but I can't just seem to figure it out.