muarachmann/laravel-invitations

Laravel invitations - simplifying sending invitations

dev-master 2022-07-28 03:15 UTC

This package is auto-updated.

Last update: 2024-08-28 07:54:15 UTC


README

Latest Version on Packagist Total Downloads Build Status CI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require muarachmann/laravel-invitations

Usage

After installing the laravel Invite Codes package, register the service provider in your config/app.php file:

Optional in Laravel 5.5 or above

'providers' => [
    MuaRachmann\Invitations\InvitationServiceProvider::class,
    MuaRachmann\Invitations\InvitationEventServiceProvider::class,
];

Configuring the package

You can publish the config file with: This is the contents of the file that will be published at config/laravel-invitations.php:

php artisan vendor:publish --provider="MuaRachmann\Invitations\InvitationServiceProvider" --tag="laravel-invitations-config"

Run migrations required for this package. If you need to customize the tables, you can configure them with:

php artisan vendor:publish --provider="MuaRachmann\Invitations\InvitationServiceProvider" --tag="laravel-invitations-migrations"

Events

Laravel Invitations comes with several events events by default

  • MuaRachmann\Invitations\Events\InvitationAccepted
  • MuaRachmann\Invitations\Events\InvitationDeclined
  • MuaRachmann\Invitations\Events\InvitationExpired
  • MuaRachmann\Invitations\Events\InvitationSent

These events have the invitation model so you can listen to these events and take approriate actions e.g send welcome email.

include listener in EventServiceProvider.php

use MuaRachmann\Invitations\Events\InvitationAccepted;
use App\Listeners\SendWelcomeEmail;

protected $listen = [
    InvitationAccepted::class => [
        SendWelcomeEmail::class,
    ],
];

SendWelcomeEmail.php

public function handle($invitation)
{
    // send welcome email to user
}

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email muarachmann@gmail.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.