Laravel Log Reader
composer require haruncpi/laravel-log-reader
Blue Batfish
composer require haruncpi/laravel-log-reader
use Illuminate\Support\Facades\File;
use Carbon\Carbon;
$date = new Carbon($request->get('date', today()));
$filePath = storage_path("logs/laravel-{$date->format('Y-m-d')}.log");
$data = [];
if (File::exists($filePath)) {
$data = [
'lastModified' => new Carbon(File::lastModified($filePath)),
'size' => File::size($filePath),
'file' => File::get($filePath),
];
}
return $data;