প্রাতিষ্ঠানিক নোটিশ
চকপাড়া ইকরা হাফিজিয়া মাদ্রাসা
Cholkpara Iqra Hafiziya Madrasha
নোটিশ
test 2
cd C:\xampp\htdocs\iqra_full
$ErrorActionPreference = "Stop"
$File = ".\resources\views\frontend\notices.blade.php"
$Stamp = Get-Date -Format "yyyyMMdd_HHmmss"
$Backup = "$File.before_route_parse_fix_$Stamp.bak"
Copy-Item $File $Backup -Force
$Utf8 = New-Object System.Text.UTF8Encoding($false)
$Content = [System.IO.File]::ReadAllText(
(Resolve-Path $File),
[System.Text.Encoding]::UTF8
)
$StartMarker = '$routeForNotice = static function'
$EndMarker = '$branchLabelForNotice = static function'
$StartIndex = $Content.IndexOf($StartMarker)
$EndIndex = $Content.IndexOf($EndMarker)
if ($StartIndex -lt 0) {
throw "ERROR: routeForNotice block not found."
}
if ($EndIndex -lt 0) {
throw "ERROR: branchLabelForNotice block not found."
}
if ($EndIndex -le $StartIndex) {
throw "ERROR: Invalid notice Blade block order."
}
$FixedBlock = @'
$routeForNotice = static function ($notice) use ($isBranch, $branch) {
/*
* Branch notice pages use the current branch route.
* All Notice page uses the shared notice route.
*/
if ($isBranch) {
return $branch . '.notices.show';
}
return 'notices.show';
};
'@
$Before = $Content.Substring(
0,
$StartIndex
)
$After = $Content.Substring(
$EndIndex
)
$Content = $Before + $FixedBlock + $After
[System.IO.File]::WriteAllText(
(Resolve-Path $File),
$Content,
$Utf8
)
Write-Host ""
Write-Host "===== ROUTE FUNCTION FIXED ====="
Write-Host "Backup: $Backup"
Write-Host ""
Write-Host "===== SHOW FIXED BLOCK ====="
Select-String `
-Path $File `
-Pattern "routeForNotice|branchLabelForNotice" `
-Context 0,12
Write-Host ""
Write-Host "===== CLEAR LARAVEL CACHE ====="
php artisan optimize:clear
Write-Host ""
Write-Host "===== BLADE COMPILE TEST ====="
php artisan view:clear
php artisan view:cache
if ($LASTEXITCODE -ne 0) {
throw "ERROR: Blade compile failed."
}
php artisan view:clear
Write-Host ""
Write-Host "===== NOTICE ROUTES ====="
php artisan route:list --name=notices
Write-Host ""
Write-Host "=============================================="
Write-Host "NOTICE PAGE PARSE ERROR FIX COMPLETE"
Write-Host "=============================================="
Write-Host ""
Write-Host "Check:"
Write-Host "http://localhost/iqra_full/notices"
Write-Host "http://localhost/iqra_full/male/notices"
Write-Host "http://localhost/iqra_full/female/notices"
$ErrorActionPreference = "Stop"
$File = ".\resources\views\frontend\notices.blade.php"
$Stamp = Get-Date -Format "yyyyMMdd_HHmmss"
$Backup = "$File.before_route_parse_fix_$Stamp.bak"
Copy-Item $File $Backup -Force
$Utf8 = New-Object System.Text.UTF8Encoding($false)
$Content = [System.IO.File]::ReadAllText(
(Resolve-Path $File),
[System.Text.Encoding]::UTF8
)
$StartMarker = '$routeForNotice = static function'
$EndMarker = '$branchLabelForNotice = static function'
$StartIndex = $Content.IndexOf($StartMarker)
$EndIndex = $Content.IndexOf($EndMarker)
if ($StartIndex -lt 0) {
throw "ERROR: routeForNotice block not found."
}
if ($EndIndex -lt 0) {
throw "ERROR: branchLabelForNotice block not found."
}
if ($EndIndex -le $StartIndex) {
throw "ERROR: Invalid notice Blade block order."
}
$FixedBlock = @'
$routeForNotice = static function ($notice) use ($isBranch, $branch) {
/*
* Branch notice pages use the current branch route.
* All Notice page uses the shared notice route.
*/
if ($isBranch) {
return $branch . '.notices.show';
}
return 'notices.show';
};
'@
$Before = $Content.Substring(
0,
$StartIndex
)
$After = $Content.Substring(
$EndIndex
)
$Content = $Before + $FixedBlock + $After
[System.IO.File]::WriteAllText(
(Resolve-Path $File),
$Content,
$Utf8
)
Write-Host ""
Write-Host "===== ROUTE FUNCTION FIXED ====="
Write-Host "Backup: $Backup"
Write-Host ""
Write-Host "===== SHOW FIXED BLOCK ====="
Select-String `
-Path $File `
-Pattern "routeForNotice|branchLabelForNotice" `
-Context 0,12
Write-Host ""
Write-Host "===== CLEAR LARAVEL CACHE ====="
php artisan optimize:clear
Write-Host ""
Write-Host "===== BLADE COMPILE TEST ====="
php artisan view:clear
php artisan view:cache
if ($LASTEXITCODE -ne 0) {
throw "ERROR: Blade compile failed."
}
php artisan view:clear
Write-Host ""
Write-Host "===== NOTICE ROUTES ====="
php artisan route:list --name=notices
Write-Host ""
Write-Host "=============================================="
Write-Host "NOTICE PAGE PARSE ERROR FIX COMPLETE"
Write-Host "=============================================="
Write-Host ""
Write-Host "Check:"
Write-Host "http://localhost/iqra_full/notices"
Write-Host "http://localhost/iqra_full/male/notices"
Write-Host "http://localhost/iqra_full/female/notices"