PHP code example of tealorca / laravel-freshchat

1. Go to this page and download the library: Download tealorca/laravel-freshchat 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/ */

    

tealorca / laravel-freshchat example snippets


/*
 * Freshchat Configurations
 */
return [

    /*
     * Freshchat's Web Messenger Token.
     *
     * You can see that on Web Messenger Settings page of Freshchat Portal.
     */
    'token'      => env('FRESHCHAT_TOKEN', null),

    /*
     * Freshchat's Web Messenger Host Value. ( it would be different based on your data region)
     *
     * Few examples:
     *
     *	https://wchat.freshchat.com
     *	https://wchat.in.freshchat.com
     *
     * You can see that on Web Messenger Settings page of Freshchat Portal.
     */
    'host'       => env('FRESHCHAT_HOST', 'https://wchat.freshchat.com'),
];

bash
php artisan vendor:publish --provider="TealOrca\LaravelFreshchat\LaravelFreshchatServiceProvider" --tag="config"

 php

class AddFreshchatRestoreIdToUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {

            if (!Schema::hasColumn('users', 'freshchat_restore_id')) {
                Schema::table('users', function (Blueprint $table) {
                    $table->string('freshchat_restore_id')->nullable();
                });
            }

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {

            if (Schema::hasColumn('users', 'freshchat_restore_id')) {
                $table->dropColumn('freshchat_restore_id');
            }
        });
    }
}