#!/usr/bin/env bash

set -ex

pushd ./example-app
  # composer update

  composer install

  # clear-compiled          Remove the compiled class file
  php artisan clear-compiled &

  # auth:clear-resets       Flush expired password reset tokens
  # cache:clear             Flush the application cache
  # config:clear            Remove the configuration cache file
  # event:clear             Clear all cached events and listeners
  # optimize:clear          Remove the cached bootstrap files
  # queue:clear             Delete all of the jobs from the specified queue

  # route:clear             Remove the route cache file
  php artisan route:clear &

  # schedule:clear-cache    Delete the cached mutex files created by scheduler

  # view:clear              Clear all compiled view files
  php artisan view:clear &

  wait
  echo 'clear cache complete'

  php artisan migrate:fresh --seed

  php artisan serve --host 0.0.0.0
popd
