Created
July 25, 2022 02:13
-
-
Save NandoKstroNet/a5f9c444727db46a19feea5b999bbe74 to your computer and use it in GitHub Desktop.
Simples contador de dados para a dash do projeto VideoFlix em https://laravelmastery.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
<div class="max-w-7xl mx-auto grid grid-cols-3 gap-6 text-center mt-20 mb-20 px-8"> | |
<div class="flex flex-col justify-center items-center h-48 shadow rounded border border-blue-600 bg-blue-400 text-blue-600 font-bold hover:bg-blue-900 hover:text-blue-300 transition ease-in-out duration-300"> | |
<h4 class="font-bold mb-8">Assinantes</h4> | |
<h3 class="text-4xl">{{$counters['customers']}}</h3> | |
</div> | |
<div class="flex flex-col justify-center items-center h-48 shadow rounded border border-indigo-600 bg-indigo-400 text-indigo-600 font-bold hover:bg-indigo-900 hover:text-indigo-300 transition ease-in-out duration-300"> | |
<h4 class="font-bold mb-8">Conteúdos</h4> | |
<h3 class="text-4xl">{{$counters['contents']}}</h3> | |
</div> | |
<div class="flex flex-col justify-center items-center h-48 shadow rounded border border-purple-600 bg-purple-400 text-purple-600 font-bold hover:bg-purple-900 hover:text-purple-300 transition ease-in-out duration-300"> | |
<h4 class="font-bold mb-8">Vídeos Processados</h4> | |
<h3 class="text-4xl">{{$counters['videos']}}</h3> | |
</div> | |
</div> |
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\Livewire; | |
use App\Models\Content; | |
use App\Models\User; | |
use App\Models\Video; | |
use Livewire\Component; | |
class DashboardCounter extends Component | |
{ | |
public function render(User $user, Content $content, Video $video) | |
{ | |
$counters = [ | |
'customers' => $user->whereRole('ROLE_USER')->count(), | |
'contents' => $content->count(), | |
'videos' => $video->whereIsProcessed(true)->count() | |
]; | |
return view('livewire.dashboard-counter')->with('counters', $counters); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment