PHP code example of derjacques / laravel-pipedrive-notification-channel

1. Go to this page and download the library: Download derjacques/laravel-pipedrive-notification-channel 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/ */

    

derjacques / laravel-pipedrive-notification-channel example snippets


// app/Notifications/ExampleNotification

use DerJacques\PipedriveNotifications\PipedriveChannel;
use DerJacques\PipedriveNotifications\PipedriveMessage;

class ExampleNotification extends Notification
{

    public function via($notifiable)
    {
        return [PipedriveChannel::class];
    }

    public function toPipedrive($notifiable)
    {
        return
            (new PipedriveMessage())
                ->deal(function ($deal) {
                    $deal->stage(1)
                         ->title('new deal')
                         ->activity(function ($activity) {
                             $activity->subject('Call Jane')
                                      ->type('call');
                         })
                         ->activity(function ($activity) {
                             $activity->id(3)
                                      ->subject('Email Joe')
                                      ->type('mail');
                         })
                         ->note(function ($note) {
                             $note->content('Link to deal');
                         });
                })
                ->activity(function ($activity) {
                    $activity->subject('Buy milk')
                             ->type('shopping')
                             ->due('2017-12-18');
                });
    }
}

// app/User.php

public function routeNotificationForPipedrive()
{
    return 'YOUR-PIPEDRIVE-KEY';
}