Skip to content

Commit

Permalink
readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lahirulhr committed Jan 25, 2022
1 parent b209fd9 commit e3b3c99
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 46 deletions.
62 changes: 28 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Simple user switch for development environment
# Laravel Auth Switch

[![Latest Version on Packagist](https://img.shields.io/packagist/v/visanduma/laravel-auth-switch.svg?style=flat-square)](https://packagist.org/packages/visanduma/laravel-auth-switch)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/visanduma/laravel-auth-switch/run-tests?label=tests)](https://github.com/visanduma/laravel-auth-switch/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/visanduma/laravel-auth-switch/Check%20&%20fix%20styling?label=code%20style)](https://github.com/visanduma/laravel-auth-switch/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/visanduma/laravel-auth-switch.svg?style=flat-square)](https://packagist.org/packages/visanduma/laravel-auth-switch)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/laravel-auth-switch.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/laravel-auth-switch)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can
support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
Simple User switch for development environment

## Installation

Expand All @@ -24,43 +15,45 @@ You can install the package via composer:
composer require visanduma/laravel-auth-switch
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="laravel-auth-switch-migrations"
php artisan migrate
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="laravel-auth-switch-config"
php artisan vendor:publish --tag="auth-switch-config"
```

This is the contents of the published config file:

```php
return [
];
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="laravel-auth-switch-views"
// username column of user table
'username_column' => 'email',

// auth able user model
'model' => \App\Models\User::class,


// switch able user accounts according to your user table
'accounts' => [
[
'name' => 'Affiliate',
'username' => '[email protected]',
'redirect_to' => 'affiliate/dashboard' // redirect to this url after login
],
[
'name' => 'Broker',
'username' => '[email protected]',
'redirect_to' => 'brokers/dashboard'
],
];
```

## Usage

```php
$laravelAuthSwitch = new Visanduma\LaravelAuthSwitch();
echo $laravelAuthSwitch->echoPhrase('Hello, Visanduma!');
```

## Testing
Include into any view where you need Auth Switching

```bash
composer test
```php
@include('auth-switch::auth-switch');
```

## Changelog
Expand All @@ -77,7 +70,8 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [LaHiRu](https://github.com/Visanduma)
- [Visanduma](https://github.com/Visanduma)
- [LaHiRu](https://github.com/lahirulhr)
- [All Contributors](../../contributors)

## License
Expand Down
19 changes: 7 additions & 12 deletions config/auth-switch.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?php
// config for Visanduma/LaravelAuthswitch


return [

// username column of user table
'username_column' => 'email',

// auth able user model
'model' => \App\Models\User::class,

// switch able user accounts according to your user table
// use redirect_to field to redirect user after successfully logged in
'accounts' => [
[
'name' => 'Affiliate',
Expand All @@ -16,17 +21,7 @@
'name' => 'Broker',
'username' => '[email protected]',
'redirect_to' => 'brokers/dashboard'
],
[
'name' => 'Seller',
'username' => '[email protected]',
'redirect_to' => 'affiliate/dashboard'
],
[
'name' => 'Owner',
'username' => '[email protected]',
'redirect_to' => 'affiliate/dashboard'
],
]

]
];

0 comments on commit e3b3c99

Please sign in to comment.