Skip to content

Commit

Permalink
Merge pull request #1 from lloy0076/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
OwenMelbz authored Dec 24, 2017
2 parents 3b6b0b0 + aac5b2b commit 8986edc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# VueJS Frontend Component for integration for Laravel Impersonate

This package adds a really simple frontend component written as a self contained Vuejs 2 component to allow you users to easily impersonate others via the API provided by https://github.com/404labfr/laravel-impersonate
This package adds a really simple frontend component written as a self contained Vuejs 2 component to allow you users to easily impersonate others via the API provided by https://github.com/404labfr/laravel-impersonate.

## Preview

Expand All @@ -12,13 +12,13 @@ This package adds a really simple frontend component written as a self contained

2. Register the service provider (if the auto discovery does not work) - typically done inside the `app.php` providers array e.g `OwenMelbz\VueImpersonate\VueImpersonateServiceProvider::class`

3. Theres 3 publishable components - the only `required` component is the javascript which you can publish with `php artisan vendor:publish` then select `vue-impersonate-javascript (required)` This will copy the .vue component into `resources/js/components/vue-impersonate.vue` - feel free to move this.
3. There are 3 publishable components - the only `required` component is the javascript which you can publish with `php artisan vendor:publish` then select `vue-impersonate-javascript (required)`. This will copy the .vue component into `resources/js/components/vue-impersonate.vue` - feel free to move this.

4. You must then include the component in your javascript bundle, typically achieved from within an entry point such as `app.js` e.g `Vue.component('vue-impersonate', require('./components/vue-impersonate.vue'));`

5. Once published you should make sure you've set up laravel-impersonate correctly by including the correct traits, and methods and routes to allow impersonating.

6. Once laravel-impersonate is set up you should include the blade directive within your template `@vueImpersonate` this should be housed within your vuejs container e.g `#app` - it will only render for users who possess the `canImpersonate` permissions.
6. Once laravel-impersonate is set up you should include the blade directive within your template `@vueImpersonate` - this should be housed within your vuejs container e.g `#app` - it will only render for users who possess the `canImpersonate` permissions.

## Configuration

Expand All @@ -32,11 +32,11 @@ If you want to rename the component from `vue-impersonate` you must publish the

### Custom user provider

By default laravel uses providers to log in users, this is defined within the `config/auth.php` then within the `providers` array - We will use the class defined within the `model` property of the provider you define. By default its called `users` so we also use that to populate the list of users on the frontend.
By default laravel uses providers to log in users, this is defined within the `config/auth.php` then within the `providers` array. We use the class defined within the `model` property of the provider you define. By default it is called `users` so that we'll also uses the configured class to populate the list of users on the frontend.

### Custom list of users

If you want more fine-grain control over which users show in the dropdown - you can set your own route and define it within the `custom_route` and we'll use that to display the users, You must return a json array with each user object containing at least an `id` and `display_name` field. e.g
If you want more fine-grain control over which users show in the dropdown, you can set your own route and define it within the `custom_route` and we'll use that to display the users. You must return a JSON array with each user object containing at least an `id` and `display_name` field. e.g

```js
[
Expand Down

0 comments on commit 8986edc

Please sign in to comment.