22 lines
457 B
PHP
22 lines
457 B
PHP
<?php
|
|
|
|
namespace App\View\Composers;
|
|
|
|
use App\Models\AiTool;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\View\View;
|
|
|
|
class StatsComposer
|
|
{
|
|
public function compose(View $view)
|
|
{
|
|
// Retrieve the count from the cache or count and store it if not present
|
|
$tools_count = Cache::remember('tools_count', 600, function () {
|
|
return AiTool::count();
|
|
});
|
|
|
|
$view->with('tools_count', $tools_count);
|
|
|
|
}
|
|
}
|