generated from kemboi22/laravel-inertia-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathartisan.ps1
More file actions
37 lines (30 loc) · 1.17 KB
/
artisan.ps1
File metadata and controls
37 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env pwsh
# Laravel Artisan Helper Script
# Usage: .\artisan.ps1 [artisan-command] [parameters...]
# Example: .\artisan.ps1 migrate --path=database/migrations/some_migration.php
# Example: .\artisan.ps1 tinker --execute="print_r(Schema::getColumnListing('posts'));"
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Arguments
)
# PHP executable path
$phpPath = "C:\Users\Oneito\AppData\Local\Microsoft\WinGet\Packages\PHP.PHP.8.3_Microsoft.Winget.Source_8wekyb3d8bbwe\php.exe"
# Check if PHP exists
if (-not (Test-Path $phpPath)) {
Write-Error "PHP not found at: $phpPath"
Write-Error "Please update the script with the correct PHP path."
exit 1
}
# Check if artisan exists
if (-not (Test-Path "artisan")) {
Write-Error "Laravel artisan file not found in current directory."
Write-Error "Please run this script from your Laravel project root."
exit 1
}
# Build the command
$command = @($phpPath, "-c", "minimal_php.ini", "artisan") + $Arguments
# Execute the command
Write-Host "Executing: $($command -join ' ')" -ForegroundColor Green
& $command[0] $command[1..($command.Length-1)]
# Capture and return the exit code
exit $LASTEXITCODE