An open API service indexing awesome lists of open source software.

https://github.com/code4mk/lara-spa-api

🔌 Laravel SPA api for Vue | React | Angular. Secure SPA api and http status
https://github.com/code4mk/lara-spa-api

0devco android code4mk ios laravel-angular-spa laravel-react-spa laravel-spa laravel-vue-spa spa-api

Last synced: 16 days ago
JSON representation

🔌 Laravel SPA api for Vue | React | Angular. Secure SPA api and http status

Awesome Lists containing this project

README

        

![spa-api](https://user-images.githubusercontent.com/17185462/53653389-68498680-3c75-11e9-8ce1-3329c84e7bd4.png)

# lara-spa-api
Laravel SPA api for Vue | React | Angular

# installation

```bash
composer require code4mk/lara-spa-api
```

## vendor publish

```bash
php artisan vendor:publish --provider="LSAPI\LSAPIServiceProvider" --tag=config
```
=> config/lsapi.php

# Middleware `lsapi` group

```php
Route::group(['middleware' => ['lsapi']], function () {
// spa routes
});

//or

Route::get('spa',function(){

})->middleware('lsapi');
```

# `exceptions/Handler.php`
* delete all code inside `Handler.php` and paste below code

```php
wantsJson()) {
return $this->handleLsapiException($request, $exception);
} else {
return parent::render($request, $exception);
}
}

}
```

# axios | guzzle `header`

you can change header name `Authorization` to `Anything` in `lsapi` config file.

```js
Authorization: Bearer xxxxx
Accept: application/json
```