This commit is contained in:
35
app/Livewire/BotLogs.php
Normal file
35
app/Livewire/BotLogs.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\BotLog;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithoutUrlPagination;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class BotLogs extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
use WithoutUrlPagination;
|
||||
|
||||
// public function mount()
|
||||
// {
|
||||
// $this->getLogs();
|
||||
// }
|
||||
|
||||
// public function getLogs(): void
|
||||
// {
|
||||
// $this->logs = Auth::user()->bots->pluck('logs')->flatten()->sortByDesc('created_at');
|
||||
// }
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.bot-logs', [
|
||||
'logs' => BotLog::whereHas('bot', fn($q) => $q->where('user_id', Auth::id()))
|
||||
->orderBy('created_at', 'desc')
|
||||
->latest()
|
||||
->paginate(10),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user