PHP code example of webmaster-hm / lern81

1. Go to this page and download the library: Download webmaster-hm/lern81 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/ */

    

webmaster-hm / lern81 example snippets


# This will only copy over the migration file. For the config file you can either rtisan migrate

public function report(Throwable $e)
{
    if ($this->shouldReport($e)) {

    	//Check to see if LERN is installed otherwise you will not get an exception.
        if (app()->bound("lern")) {
            app()->make("lern")->handle($e); //Record and Notify the Exception

            /*
            OR...
            app()->make("lern")->record($e); //Record the Exception to the database
            app()->make("lern")->notify($e); //Notify the Exception
            */
        }
    }

    return parent::report($e);
}

//If you updated your aliases array in "config/app.php"
use LERN;
use Throwable;
//or if you didnt...
use Tylercd100\LERN\Facades\LERN;
use Throwable;

use Tylercd100\LERN\Models\ExceptionModel;
$mostRecentException = ExceptionModel::orderBy('created_at','DESC')->first();

'record'=>[
    /**
     * The Model to use
     */
    'model' => \Tylercd100\LERN\Models\ExceptionModel::class,

    /**
     * Database connection to use. Null is the default connection.
     */
    'connection'=>null,

    /**
     * Database table to use
     */
    'table'=>'vendor_tylercd100_lern_exceptions',

    /**
     * Information to store
     */
	'collect'=>[
	    'method'=>false, //When true it will collect GET, POST, DELETE, PUT, etc...
	    'data'=>false, //When true it will collect Input data
	    'status_code'=>true,
	    'user_id'=>false,
	    'url'=>false,
        'ip'=>false,
	],
],

// Change the log level.
// Default is: critical
// Options are: debug, info, notice, warning, error, critical, alert, emergency
LERN::setLogLevel("emergency");

//Change the subject
LERN::setSubject("An Exception was thrown!");

'notify'=>[
    'view'=>'exceptions.default',
],

'notify'=>[
    'view'=>null,
],

use Monolog\Handler\SlackHandler;
$handler = new SlackHandler($token, $channel);
LERN::pushHandler($handler);
LERN::notify($exception);
bash
php artisan vendor:publish --provider="Tylercd100\LERN\LERNServiceProvider"
bash
php artisan migrate