PHP code example of syedaunn / laravel-slack-output

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

    

syedaunn / laravel-slack-output example snippets


'providers' => [
  ...
  SyedAunn\SlackOutput\ServiceProvider::class,
],

'aliases' => [
  ...
  'SlackOutput' => SyedAunn\SlackOutput\Facade\SlackOutput::class,
],

Artisan::queue('slack:post', [
  'to' => "#api-output",
  'attach' => $someAttachment,
  'message' => "Hello, I'm a bot"
]);

'classes' => [
	  \App\Models\User::class => [
		  'is_active' => true //optional constraint
	  ]
],

'dates' => [
	'yesterday' => \Carbon\Carbon::yesterday(),
	'last week' => \Carbon\Carbon::today()->subWeek(1)
]

protected function schedule(Schedule $schedule)
{
  $schedule->command('slack:stats')->daily()
}

use SyedAunn\SlackOutput\Facade\SlackOutput;

...

public function report(Exception $e)
{
  if ($this->shouldReport($e)) {
    SlackOutput::exception($e);
  }

  parent::report($e);
}

use SyedAunn\SlackOutput\Facade\SlackOutput;

...

public function boot()
{
  Queue::failing(function (JobFailed $job) {
    SlackOutput::jobFailed($job);
  });
}

use SyedAunn\SlackOutput\Facade\SlackOutput;

...

protected function schedule(Schedule $schedule)
{
  SlackOutput::scheduledCommand(
    $schedule->command('db:backup-auto')->daily()
  );
}
sh
php artisan vendor:publish --provider="SyedAunn\SlackOutput\ServiceProvider"