75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Mail\test;
|
|
use App\Models\InvoiceValidation;
|
|
use App\Models\Plant;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Route::get('/', function () {
|
|
// return redirect('/admin');
|
|
// });
|
|
Route::get('/', function () {
|
|
$host = request()->getHost();
|
|
|
|
if ($host == 'pds.iotsignin.com') {
|
|
return redirect()->away('https://pds1.iotsignin.com/');
|
|
}
|
|
|
|
return redirect('/admin'); // default redirect
|
|
});
|
|
|
|
// Route::get('/scheduler', function() {
|
|
// Artisan::call('schedule:run');
|
|
// });
|
|
|
|
|
|
// Route::get('/test_mail', function () {
|
|
|
|
|
|
// $plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
|
|
|
|
// $tableData = [];
|
|
// $no = 1;
|
|
|
|
// foreach ($plants as $plantId) {
|
|
|
|
// $plant = Plant::find($plantId);
|
|
|
|
// $plantName = $plant ? $plant->name : $plantId;
|
|
|
|
// $totalInvoice = InvoiceValidation::where('plant_id', $plantId)
|
|
// ->distinct('invoice_number')
|
|
// ->count('invoice_number');
|
|
|
|
// $startDate = now()->setTime(8, 0, 0);
|
|
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
|
|
|
// $scannedInvoice = InvoiceValidation::select('invoice_number')
|
|
// ->where('plant_id', $plantId)
|
|
// ->whereNull('quantity')
|
|
// ->whereBetween('updated_at', [$startDate, $endDate])
|
|
// ->groupBy('invoice_number')
|
|
// ->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
|
// ->count();
|
|
|
|
// $tableData[] = [
|
|
// 'no' => $no++,
|
|
// 'plant' => $plantName,
|
|
// 'totalInvoice' => $totalInvoice,
|
|
// 'scannedInvoice' => $scannedInvoice,
|
|
// ];
|
|
// }
|
|
|
|
// Mail::to('jothikumar.padmanaban@cripumps.com')->send(
|
|
// new test($tableData)
|
|
// );
|
|
// // Mail::to([
|
|
// // 'jothikumar.padmanaban@cripumps.com',
|
|
// // 'tamilselvan.selvaraj@cripumps.com',
|
|
// // 'dineshkumar.kaliyappan@cripumps.com'
|
|
// // ])->send(new test($tableData));
|
|
|
|
// return "Mail sent!";
|
|
// });
|