#!/bin/sh

# Format php by laravel pint
files=$(git diff --cached --name-only --diff-filter=AMCR -- '*.php')
if [[ -n $files ]];
then
    ./vendor/bin/pint --config ./pint.json $files --dirty
    git add $files
else
	echo "There is no *.php files to format."
fi

# Format blade by blade formatter
files=$(git diff --cached --name-only --diff-filter=AMCR  -- '*.blade.php')
if [[ -n $files ]];
then
    ./node_modules/.bin/blade-formatter --write $files --config ./.bladeformatterrc.json
    git add $files
else
	echo "There is no *.blade.php files to format."
fi