Last active
January 26, 2022 15:37
-
-
Save NandoKstroNet/88469e797005e504620111e7edfb948c to your computer and use it in GitHub Desktop.
Checkout Lojas do Projeto Laravel Tenancy em https://codeexperts.com.br/curso/laravel-tenancy-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<x-guest-layout> | |
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | |
<h3 class="text-2xl font-extrabold my-8"></h3> | |
<hr> | |
<h5 class="my-20 text-4xl text-center font-extrabold">Checkout</h5> | |
<hr> | |
<div class="w-1/2 block mx-auto mt-10"> | |
<form action="{{route('checkout.proccess', request('subdomain'))}}" method="post"> | |
@csrf | |
<div class="w-full mb-8"> | |
<label class="block">Número Cartão</label> | |
<input type="text" name="card_number" class="w-full"> | |
</div> | |
<div class="w-full mb-8 flex justify-between"> | |
<div> | |
<label class="block">Validade</label> | |
<input type="text" name="card_date"> | |
</div> | |
<div> | |
<label class="block">Código de Segurança</label> | |
<input type="text" name="card_cvv"> | |
</div> | |
</div> | |
<button | |
class="text-xl font-bold px-4 py-2 rounded bg-green-600 text-white shadow hover:bg-green-300 transition ease-in-out delay-150 uppercase">Realizar Pagamento</button> | |
</form> | |
</div> | |
</div> | |
</x-guest-layout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Front; | |
use App\Http\Controllers\Controller; | |
use App\Services\CartService; | |
use Illuminate\Http\Request; | |
class CheckoutController extends Controller | |
{ | |
public function checkout($subdomain, CartService $cartService) | |
{ | |
if(!$cartService->all()) abort(500); | |
return view('front.checkout'); | |
} | |
public function proccess($subdomain, CartService $cartService, Request $request) | |
{ | |
if(!$cartService->all()) abort(500); | |
$cartService->clear(); | |
return redirect()->route('checkout.thanks', $subdomain); | |
} | |
public function thanks($subdomain, CartService $cartService) | |
{ | |
if(!$cartService->all()) abort(500); | |
return view('front.thanks'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<x-guest-layout> | |
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | |
<h3 class="text-2xl font-extrabold my-8"></h3> | |
<hr> | |
<h5 class="my-20 text-4xl text-center font-extrabold">Obrigado</h5> | |
<hr> | |
<div class="w-1/2 block mx-auto mt-10 text-center"> | |
<h3 class="text-3xl font-extrabold">Muito obrigado por sua compra!!</h3> | |
</div> | |
</div> | |
</x-guest-layout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::prefix('checkout')->middleware('auth.stores')->name('checkout.')->group(function(){ | |
Route::get('/', [\App\Http\Controllers\Front\CheckoutController::class, 'checkout'])->name('checkout'); | |
Route::post('/proccess', [\App\Http\Controllers\Front\CheckoutController::class, 'proccess'])->name('proccess'); | |
Route::get('/thanks', [\App\Http\Controllers\Front\CheckoutController::class, 'thanks'])->name('thanks'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment