diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 144ec1e..38f2a8a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,62 +12,27 @@ jobs: steps: - name: Deploy - uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0 + uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - fingerprint: ${{ secrets.SSH_HOST_FINGERPRINT }} port: ${{ secrets.PORT }} script_stop: true + script: | - set -ex + set -e - export PATH="$HOME/.phpenv/shims:$PATH" - umask 002 + cd ~/httpdocs - php -v - - BRANCH="production" - - cd httpdocs - - if test -d .git; then - echo "Updating source..." - - git fetch origin - - git reset --hard origin/$BRANCH - else - echo "First deploy..." - - git clone -b "$BRANCH" "${{ secrets.REPO_URL }}" . - fi - - mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache - chmod -R u+rwX storage bootstrap/cache vendor 2>/dev/null || true - - if test -e vendor/composer/installed.php && ! test -w vendor/composer/installed.php; then - echo "vendor/composer/installed.php is not writable by $(whoami). Current ownership:" - ls -ld vendor vendor/composer vendor/composer/installed.php - exit 1 - fi - - if test -d vendor/composer && ! test -w vendor/composer; then - echo "vendor/composer is not writable by $(whoami). Current ownership:" - ls -ld vendor vendor/composer - exit 1 - fi - - composer install --no-dev --optimize-autoloader - - composer dump-autoload --no-dev --optimize + echo "==> Pulling latest code..." + git fetch origin production + git reset --hard origin/production + echo "==> Running migrations..." php artisan migrate --force - php artisan config:clear + echo "==> Optimizing Laravel..." php artisan optimize - php artisan queue:restart || true - - echo "Deploy completed." + echo "==> Deploy completed!" diff --git a/app/Http/Requests/CreateCustomerRequest.php b/app/Http/Requests/CreateCustomerRequest.php index 2dfc72f..e76dda4 100644 --- a/app/Http/Requests/CreateCustomerRequest.php +++ b/app/Http/Requests/CreateCustomerRequest.php @@ -25,6 +25,7 @@ class CreateCustomerRequest extends FormRequest 'fullname' => 'required', 'email' => 'required|email', 'password' => $this->isMethod('post') ? 'required|min:6' : 'nullable|min:6', + 'status' => 'nullable|integer|in:0,1,2,3', 'company' => 'nullable', 'phone' => 'nullable', 'address' => 'nullable', diff --git a/database/migrations/2026_09_29_000001_fix_customers_unpaid_total_default.php b/database/migrations/2026_09_29_000001_fix_customers_unpaid_total_default.php new file mode 100644 index 0000000..a1b97ff --- /dev/null +++ b/database/migrations/2026_09_29_000001_fix_customers_unpaid_total_default.php @@ -0,0 +1,17 @@ +integer('unpaid_total')->default(0)->change(); + }); + } + + public function down(): void {} +};