Last active
July 29, 2022 02:48
-
-
Save NandoKstroNet/3024e40167363c70cbe0f1b48c81c6b7 to your computer and use it in GitHub Desktop.
Meus Pedidos Projeto MultiTenant Single Database em https://codeexperts.com.br
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"> | |
<hr> | |
<h5 class="my-20 text-4xl text-center font-extrabold">Meus Pedidos</h5> | |
<a href="{{route('front.store', [request('subdomain')])}}" class="mt-2 underline text-blue-600 mb-10 block">Home</a> | |
<hr> | |
<div class="flex justify-between items-center"> | |
<div class="accordion-container w-full"> | |
@forelse($userOrders as $order) | |
<div class="ac"> | |
<h2 class="ac-header border-b border-gray-200"> | |
<button type="button" class="ac-trigger" style="display: flex; justify-content: space-between;"> | |
<span> Pedido: {{$order->code}}</span> | |
<span>Status: {{$order->payment_status}}</span> | |
</button> | |
</h2> | |
<div class="ac-panel"> | |
<p class="ac-text" style="padding: 2%;"> | |
<h3 style="margin-left: 2% !important; margin-bottom: 10px; font-weight: bold;">Items pedido:</h3> | |
<ul style="margin-left: 4% !important;"> | |
@php $totalOrder = 0; @endphp | |
@foreach($order->items as $item) | |
<li>{{$item['name']}}</li> | |
@php $totalOrder += $item['price']; $shippingValue = $order->shipping_value; @endphp | |
@endforeach | |
</ul> | |
<p style="width: 100%; margin-left: 4%; margin-top: 20px;"> | |
Total Pedido: <strong>R$ {{number_format($totalOrder, 2, ',', '.')}}</strong> <br> | |
Frete: <strong>R$ {{number_format($shippingValue, 2, ',', '.')}}</strong> | |
<br> | |
Total com frete: <strong>R$ {{number_format($totalOrder + $shippingValue, 2, ',', '.')}}</strong> | |
</p> | |
</p> | |
</div> | |
</div> | |
@empty | |
<div class="w-full"> | |
<h3>Nenhum pedido encontrado...</h3> | |
</div> | |
@endforelse | |
</div> | |
</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\Models\Store; | |
use Illuminate\Http\Request; | |
class MyOrdersController extends Controller | |
{ | |
public function index($subdomain) | |
{ | |
$userOrders = Store::whereSubdomain($subdomain) | |
->first() | |
->customers() | |
->find(auth()->id()) | |
->orders | |
; | |
return view('front.my-orders', compact('userOrders')); | |
} | |
} |
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::get('/my-orders', [\App\Http\Controllers\Front\MyOrdersController::class, 'index']) | |
->name('my.orders') | |
->middleware('auth') | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment