Skip to content

Commit

Permalink
Merge pull request #8 from mlanin/refactor/remove-views
Browse files Browse the repository at this point in the history
Remove conversion to view
  • Loading branch information
mlanin authored Aug 6, 2019
2 parents 317447d + 64217a9 commit 1c94f8f
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 333 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ language: php
php:
- 5.6
- 7.0
- hhvm
- 7.1

sudo: false

cache:
directories:
- $HOME/.composer/cache

install:
- travis_retry composer install --no-interaction --prefer-dist

before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist

script:
- if [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For Laravel 5.1

For Laravel 5.3
```
"lanin/laravel-api-exceptions": "^0.3.0"
"lanin/laravel-api-exceptions": "^1.0.0"
```

You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.
Expand Down Expand Up @@ -92,16 +92,6 @@ protected function formatApiResponse(ApiException $exception)
}
```

### Views

Since version 0.3.0 for Laravel 5.3 package can also return html view of the error, if `Accept` header not equals `application/json`.

To change included views publish them via:

```
$ php artisan vendor:publish --tag=laravel-api-exceptions
```

### Handler

Extend your default exceptions handler with:
Expand Down
7 changes: 0 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
"Lanin\\Laravel\\ApiExceptions\\Tests\\": "tests/"
}
},
"extra":{
"laravel":{
"providers":[
"Lanin\\Laravel\\ApiExceptions\\ApiExceptionsServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
Expand Down
47 changes: 0 additions & 47 deletions resources/views/errors/401.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/errors/403.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/errors/404.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/errors/405.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/errors/500.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/errors/503.blade.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function toJson($options = 0)
/**
* Convert exception to array.
*
* @return string
* @return array
*/
public function toArray()
{
Expand Down
8 changes: 0 additions & 8 deletions src/ApiExceptionsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ public function boot()
$this->app['validator']->resolver(function ($translator, $data, $rules, $messages, $attributes) {
return new Validator($translator, $data, $rules, $messages, $attributes);
});

$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-api-exceptions');

if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../resources/views' => base_path('resources/views'),
], 'laravel-api-exceptions');
}
}

/**
Expand Down
Loading

0 comments on commit 1c94f8f

Please sign in to comment.