Skip to content

Commit

Permalink
Added instructions on how to generate an ApiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbjr committed Mar 9, 2016
1 parent 2a5aa7f commit 36503a2
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,7 @@ It will setup two tables - api_keys and api_logs.

### Laravel 5.0.x to 5.1.x

Run `composer require chrisbjr/api-guard 2.0.*`

In your `config/app.php` add `Chrisbjr\ApiGuard\Providers\ApiGuardServiceProvider` to the end of the `providers` array

```php
'providers' => array(

...
Chrisbjr\ApiGuard\Providers\ApiGuardServiceProvider::class,
),
```

Now publish the migration and configuration files for api-guard:

$ php artisan vendor:publish --provider="Chrisbjr\ApiGuard\Providers\ApiGuardServiceProvider"

Then run the migration:

$ php artisan migrate

It will setup two tables - api_keys and api_logs.
Note: Documentation for use with Laravel 5.0.x and 5.1.x differs from Laravel 5.2.x. Please refer to the README [here](https://github.com/chrisbjr/api-guard/tree/v2.3.0).

### Laravel 4.2.x

Expand All @@ -101,12 +81,10 @@ To generate an API key that is linked to a user, you can do the following:

`php artisan api-key:generate --user-id=1`

To generate an API key from within your application, you can use the available Facade:
To generate an API key from within your application, you can use the following method in the `ApiKey` model:

```
$apiKey = new Chrisbjr\ApiGuard\Models\ApiKey;
$apiKey->key = $apiKey->generateKey();
$apiKey->save();
$apiKey = Chrisbjr\ApiGuard\Models\ApiKey::make()
```

## Usage
Expand Down

0 comments on commit 36503a2

Please sign in to comment.