PHP code example of jhacobs / laravel-invites

1. Go to this page and download the library: Download jhacobs/laravel-invites library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jhacobs / laravel-invites example snippets


use Jhacobs\Invites\Contracts\CanBeInvited;

class User extends Authenticatable implements CanBeInvited

public function sendInviteNotification(string $token)
{
    return 'email';
}

public function sendInviteNotification(string $token)
{
    $this->notify(new InviteUserNotification($token));
}

use Jhacobs\Invites\Facades\Invite;
use App\Models\User;

$user = User::find(1);

Invite::sendInviteLink($user);

use Jhacobs\Invites\Facades\Invite;

Invite::createPassword($request->get('email'), $request->get('token'), $request->get('password'), function (User $user, string $password) {
    $user->password = Hash::make($password);
    $user->save();
});

php artisan vendor:publish --provider="Invites\InviteServiceProvider" --tag=config

php artisan vendor:publish --provider="Invites\InviteServiceProvider" --tag=migrations