Fixed undefined variable 'file' error

Fixed undefined variable 'file' error when running php artisan optimize.