Skip to content

Instantly share code, notes, and snippets.

@CreativeWolf
Created September 17, 2018 13:45
Show Gist options
  • Select an option

  • Save CreativeWolf/cc78cee17483ef6c9bf7a316ae4ef95b to your computer and use it in GitHub Desktop.

Select an option

Save CreativeWolf/cc78cee17483ef6c9bf7a316ae4ef95b to your computer and use it in GitHub Desktop.

Revisions

  1. CreativeWolf created this gist Sep 17, 2018.
    107 changes: 107 additions & 0 deletions EjabberdController.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@
    <?php

    namespace App\Http\Controllers;

    use Illuminate\Http\Request;
    use App\Http\Controllers\Controller;
    use Illuminate\Support\Facades\DB;
    // use Illuminate\Support\Facades\Facade;
    use Ejabberd;
    use Ejabberd\Commands\Contracts\IEjabberdCommand;
    use Ejabberd\Commands\CreateUser;
    use Ejabberd\Commands\SendMessage;
    use Ejabberd\Facades;
    use GuzzleHttp\Client;
    use GuzzleHttp\Exception\GuzzleException;
    use Illuminate\Support\Facades\Log;

    class EjabberdController extends Controller
    {
    /**
    * Display a listing of the resource.
    *
    * @return \Illuminate\Http\Response
    */

    public function index()
    {
    }

    public function chat()
    {
    $type = "message";
    $from = "admin@localhost";
    $to = "user@localhost";
    $subject = "Test Subject Laravel";
    $body = "Test Body Laravel";
    $send_message = new SendMessage($type, $from, $to, $subject, $body);
    $response = Ejabberd::sendMessage($send_message);
    return $response;
    }

    /**
    * Show the form for creating a new resource.
    *
    * @return \Illuminate\Http\Response
    */
    public function create()
    {
    //
    }

    /**
    * Store a newly created resource in storage.
    *
    * @param \Illuminate\Http\Request $request
    * @return \Illuminate\Http\Response
    */
    public function store(Request $request)
    {
    //
    }

    /**
    * Display the specified resource.
    *
    * @param int $id
    * @return \Illuminate\Http\Response
    */
    public function show($id)
    {
    //
    }

    /**
    * Show the form for editing the specified resource.
    *
    * @param int $id
    * @return \Illuminate\Http\Response
    */
    public function edit($id)
    {
    //
    }

    /**
    * Update the specified resource in storage.
    *
    * @param \Illuminate\Http\Request $request
    * @param int $id
    * @return \Illuminate\Http\Response
    */
    public function update(Request $request, $id)
    {
    //
    }

    /**
    * Remove the specified resource from storage.
    *
    * @param int $id
    * @return \Illuminate\Http\Response
    */
    public function destroy($id)
    {
    //
    }
    }
    235 changes: 235 additions & 0 deletions config_app.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,235 @@
    <?php

    return [

    /*
    |--------------------------------------------------------------------------
    | Application Name
    |--------------------------------------------------------------------------
    |
    | This value is the name of your application. This value is used when the
    | framework needs to place the application's name in a notification or
    | any other location as required by the application or its packages.
    |
    */

    'name' => env('APP_NAME', 'Laravel'),

    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services your application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => env('APP_DEBUG', false),

    /*
    |--------------------------------------------------------------------------
    | Application URL
    |--------------------------------------------------------------------------
    |
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.
    |
    */

    'url' => env('APP_URL', 'http://localhost'),

    /*
    |--------------------------------------------------------------------------
    | Application Timezone
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default timezone for your application, which
    | will be used by the PHP date and date-time functions. We have gone
    | ahead and set this to a sensible default for you out of the box.
    |
    */

    'timezone' => 'UTC',

    /*
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    */

    'locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Application Fallback Locale
    |--------------------------------------------------------------------------
    |
    | The fallback locale determines the locale to use when the current one
    | is not available. You may change the value to correspond to any of
    | the language folders that are provided through your application.
    |
    */

    'fallback_locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Encryption Key
    |--------------------------------------------------------------------------
    |
    | This key is used by the Illuminate encrypter service and should be set
    | to a random, 32 character string, otherwise these encrypted strings
    | will not be safe. Please do this before deploying an application!
    |
    */

    'key' => env('APP_KEY'),

    'cipher' => 'AES-256-CBC',

    /*
    |--------------------------------------------------------------------------
    | Logging Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log settings for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Settings: "single", "daily", "syslog", "errorlog"
    |
    */

    'log' => env('APP_LOG', 'single'),

    'log_level' => env('APP_LOG_LEVEL', 'debug'),

    /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    */

    'providers' => [

    /*
    * Laravel Framework Service Providers...
    */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Notifications\NotificationServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    CTL\XMPPMessageBase\IMServiceProvider::class,
    Ejabberd\Providers\EjabberdServiceProvider::class,

    /*
    * Package Service Providers...
    */

    /*
    * Application Service Providers...
    */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    // App\Providers\BroadcastServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,

    ],

    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => [

    'App' => Illuminate\Support\Facades\App::class,
    'Artisan' => Illuminate\Support\Facades\Artisan::class,
    'Auth' => Illuminate\Support\Facades\Auth::class,
    'Blade' => Illuminate\Support\Facades\Blade::class,
    'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
    'Bus' => Illuminate\Support\Facades\Bus::class,
    'Cache' => Illuminate\Support\Facades\Cache::class,
    'Config' => Illuminate\Support\Facades\Config::class,
    'Cookie' => Illuminate\Support\Facades\Cookie::class,
    'Crypt' => Illuminate\Support\Facades\Crypt::class,
    'DB' => Illuminate\Support\Facades\DB::class,
    'Eloquent' => Illuminate\Database\Eloquent\Model::class,
    'Event' => Illuminate\Support\Facades\Event::class,
    'File' => Illuminate\Support\Facades\File::class,
    'Gate' => Illuminate\Support\Facades\Gate::class,
    'Hash' => Illuminate\Support\Facades\Hash::class,
    'Lang' => Illuminate\Support\Facades\Lang::class,
    'Log' => Illuminate\Support\Facades\Log::class,
    'Mail' => Illuminate\Support\Facades\Mail::class,
    'Notification' => Illuminate\Support\Facades\Notification::class,
    'Password' => Illuminate\Support\Facades\Password::class,
    'Queue' => Illuminate\Support\Facades\Queue::class,
    'Redirect' => Illuminate\Support\Facades\Redirect::class,
    'Redis' => Illuminate\Support\Facades\Redis::class,
    'Request' => Illuminate\Support\Facades\Request::class,
    'Response' => Illuminate\Support\Facades\Response::class,
    'Route' => Illuminate\Support\Facades\Route::class,
    'Schema' => Illuminate\Support\Facades\Schema::class,
    'Session' => Illuminate\Support\Facades\Session::class,
    'Storage' => Illuminate\Support\Facades\Storage::class,
    'URL' => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View' => Illuminate\Support\Facades\View::class,
    'IM' => CTL\XMPPMessageBase\IM::class,
    //'Ejabberd' => Ejabberd\Facades\EjabberdFacade::class,

    ],

    ];
    165 changes: 165 additions & 0 deletions stacktrace
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,165 @@
    54
    ErrorException
    …/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php80
    53
    class_alias
    …/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php80
    52
    Illuminate\Foundation\AliasLoader load
    [internal]0
    51
    spl_autoload_call
    …/app/Http/Controllers/EjabberdController.php38
    50
    App\Http\Controllers\EjabberdController chat
    …/vendor/laravel/framework/src/Illuminate/Routing/Controller.php54
    49
    call_user_func_array
    …/vendor/laravel/framework/src/Illuminate/Routing/Controller.php54
    48
    Illuminate\Routing\Controller callAction
    …/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php45
    47
    Illuminate\Routing\ControllerDispatcher dispatch
    …/vendor/laravel/framework/src/Illuminate/Routing/Route.php212
    46
    Illuminate\Routing\Route runController
    …/vendor/laravel/framework/src/Illuminate/Routing/Route.php169
    45
    Illuminate\Routing\Route run
    …/vendor/laravel/framework/src/Illuminate/Routing/Router.php658
    44
    Illuminate\Routing\Router Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php30
    43
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php41
    42
    Illuminate\Routing\Middleware\SubstituteBindings handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    41
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    40
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php68
    39
    Illuminate\Foundation\Http\Middleware\VerifyCsrfToken handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    38
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    37
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php49
    36
    Illuminate\View\Middleware\ShareErrorsFromSession handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    35
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    34
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php63
    33
    Illuminate\Session\Middleware\StartSession handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    32
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    31
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php37
    30
    Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    29
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    28
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php66
    27
    Illuminate\Cookie\Middleware\EncryptCookies handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    26
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    25
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php102
    24
    Illuminate\Pipeline\Pipeline then
    …/vendor/laravel/framework/src/Illuminate/Routing/Router.php660
    23
    Illuminate\Routing\Router runRouteWithinStack
    …/vendor/laravel/framework/src/Illuminate/Routing/Router.php635
    22
    Illuminate\Routing\Router runRoute
    …/vendor/laravel/framework/src/Illuminate/Routing/Router.php601
    21
    Illuminate\Routing\Router dispatchToRoute
    …/vendor/laravel/framework/src/Illuminate/Routing/Router.php590
    20
    Illuminate\Routing\Router dispatch
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php176
    19
    Illuminate\Foundation\Http\Kernel Illuminate\Foundation\Http\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php30
    18
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/fideloper/proxy/src/TrustProxies.php56
    17
    Fideloper\Proxy\TrustProxies handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    16
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    15
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php30
    14
    Illuminate\Foundation\Http\Middleware\TransformsRequest handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    13
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    12
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php30
    11
    Illuminate\Foundation\Http\Middleware\TransformsRequest handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    10
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    9
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php27
    8
    Illuminate\Foundation\Http\Middleware\ValidatePostSize handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    7
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    6
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php46
    5
    Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode handle
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php149
    4
    Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
    …/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php53
    3
    Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
    …/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php102
    2
    Illuminate\Pipeline\Pipeline then
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php151
    1
    Illuminate\Foundation\Http\Kernel sendRequestThroughRouter
    …/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php116
    0
    Illuminate\Foundation\Http\Kernel handle
    …/public/index.php55