Rupert  Beatty

Rupert Beatty


LERN (Laravel Exception Recorder and Notifier)

LERN (Laravel Exception Recorder and Notifier)

LERN from your mistakes

LERN is a Laravel 5 package that will record exceptions into a database and will send you a notification.

Currently supported notification channels via Monolog

Version Compatibility

6.x5.x and 6.x

Migrating from 3.x to 4.x

Make sure that the config file now includes the new lern.notify.class and lern.record.class settings. Check the config file to see how they are used.

Migrating from 2.x to 3.x

Version 3.x introduces the ability to collect more information from the error such as the user_id, url, method, and input data. In order to use 3.x you will need to copy over the new config file, the migration file and then migrate it.

# This will only copy over the migration file. For the config file you can either include the --force flag (Which will overwrite it) or copy it manually from github
php artisan vendor:publish --provider="Tylercd100\LERN\LERNServiceProvider"
php artisan migrate


Version 4.x uses Package Discovery. If you are using 3.x you will need to follow these instructions.

Install via composer - In the terminal:

composer require tylercd100/lern

Then you will need to run these commands in the terminal in order to copy the config and migration files

php artisan vendor:publish --provider="Tylercd100\LERN\LERNServiceProvider"

Before you run the migration you may want to take a look at config/lern.php and change the table property to a table name that you would like to use. After that run the migration

php artisan migrate


To use LERN modify the report method in the app/Exceptions/Handler.php file

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

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

    return parent::report($e);

Dont forget to add this to the top of the file

//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;


You can call LERN::record($exception); to record an Exception to the database. To query any Exception that has been recorded you can use ExceptionModel which is an Eloquent Model

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

To change what is recorded in to the database take a look at config/lern.php

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

     * Database connection to use. Null is the default connection.

     * Database table to use

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

Note: If you change lern.recorder.model then lern.recorder.table and lern.recorder.connection will be ignored unless you extend \Tylercd100\LERN\Models\ExceptionModel::class


LERN uses the Monolog library to send notifications. If you need more than the supported notification channels, then you can add your own custom Monolog handlers. To start using any of the supported handlers just edit the provided config file config/lern.php.

Changing the log level programmatically

Some notification services support different log levels. If changing the config value lern.notify.log_level is not enough then try it this way:

// Change the log level.
// Default is: critical
// Options are: debug, info, notice, warning, error, critical, alert, emergency

Changing the subject line

Some notification services support a subject line, this is how you change it.

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

Changing the body of the notification

LERN publishes a default blade template file that you can find at resources/views/exceptions/default.blade.php. The blade template file is compiled with these values: $exception $url $method $data $user. To specify a different blade template file, just edit the config file


(deprecated) Using the LERN::setMessage() function

Make sure that you set the view config value to null or the LERN::setMessage() will not work


Custom Monolog Handlers

To use a custom Monolog Handler call the pushHandler method

use Monolog\Handler\SlackHandler;
$handler = new SlackHandler($token, $channel);

Further Reading and How-Tos


  • Support more Monolog Handlers
  • Exception report page or command to easily identify your application's issues.

Author: tylercd100
Source Code: 
License: MIT license

#laravel #email #database #notification 

What is GEEK

Buddha Community

LERN (Laravel Exception Recorder and Notifier)
Seamus  Quitzon

Seamus Quitzon


Php how to delete multiple rows through checkbox using ajax in laravel

First thing, we will need a table and i am creating products table for this example. So run the following query to create table.

CREATE TABLE `products` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
 `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
 `updated_at` datetime DEFAULT NULL,

Next, we will need to insert some dummy records in this table that will be deleted.

INSERT INTO `products` (`name`, `description`) VALUES

('Test product 1', 'Product description example1'),

('Test product 2', 'Product description example2'),

('Test product 3', 'Product description example3'),

('Test product 4', 'Product description example4'),

('Test product 5', 'Product description example5');

Now we are redy to create a model corresponding to this products table. Here we will create Product model. So let’s create a model file Product.php file under app directory and put the code below.


namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
    protected $fillable = [

Step 2: Create Route

Now, in this second step we will create some routes to handle the request for this example. So opeen routes/web.php file and copy the routes as given below.


Route::get('product', 'ProductController@index');
Route::delete('product/{id}', ['as'=>'product.destroy','uses'=>'ProductController@destroy']);
Route::delete('delete-multiple-product', ['as'=>'product.multiple-delete','uses'=>'ProductController@deleteMultiple']);

#laravel #delete multiple rows in laravel using ajax #laravel ajax delete #laravel ajax multiple checkbox delete #laravel delete multiple rows #laravel delete records using ajax #laravel multiple checkbox delete rows #laravel multiple delete

Juned Ghanchi


Laravel App Development Company in India, Hire Laravel Developers

Hire our expert team of Laravel app developers for flexible PHP applications across various cloud service providers.

With this easy build technology, we develop feature-rich apps that make your complex business process a lot easier. Our apps are,

  • More secure and scalable.
  • A good framework lets you manage and organize resources better.
  • And have a rich community base.

Get your business a best in classlaravel app. Hire laravel app developers in India. We have the best organizational set-up to provide you the most advanced app development services.

#laravel app development company india #hire laravel developers india #laravel app development company #hire laravel developers #laravel development agency #laravel app programmers

sophia tondon

sophia tondon


Top Laravel Development Company India | Laravel Development Services

Laravel is a popular framework for website development, acquiring 25.85% of the PHP framework market share. As a most admired framework among PHP frameworks, it is being utilized for e-commerce, enterprise, social media, and various different types of websites.

There are more than 1 million websites worldwide available over the web that are created using Laravel. Laravel framework is the first preference of PHP developers as it allows them to develop highly scalable, flexible, and faster web applications.

Surely, you, too, would want to deliver a splendid and unhindered user experience to your target audience over the web. Laravel framework can help you achieve this pursuit at ease; all you need to do is hire Laravel developers from reliable & coveted hosts. But! There is no shortage of Laravel development companies that promise to deliver an excellent solution, but only some are able to deliver top-notch quality.

Therefore, I have decided to enlist top Laravel development companies to help you find a reliable and expert host for web development. So, stay hooked with me till the end of this article and explore the best Laravel developers in 2021.

While creating this list, I have kept the following pointers in reflection:

Years of excellence (average 8 years)
Rewards & Recognition
Client rating & feedback
Hourly/Monthly Price
Number of happy clients
Number of successfully launched projects
Minimum man-years experience
So, let’s not waste a minute and glance at top Laravel development companies to hire for creating excellent web solutions.

Read More -

#hire a laravel developer #hire laravel developer #hire laravel developers #laravel developer for hire #laravel developers #laravel developers for hire

sophia tondon

sophia tondon


Hire Laravel Developers | Laravel Development Company, Services India

Looking for a team of experienced offshore Laravel developers? Hire a top dedicated team of Laravel developers from India online with 6+ years of average experience on an hourly or dedicated (monthly) basis from ValueCoders and enjoy easy hiring, quality work, and on-demand scalability at up to 60% less cost.

Our offshore Laravel development experts are fully competent to build scalable, secure, and robust custom web apps suiting your business requirements.

First Time Right Process
Complete Control Over The Team
Certified Laravel Coders
Agile & DevOps Enablement
Non-Disclosure Agreement
No Contract Lock-Ins

Visit Us-

#hire a laravel developer #hire laravel developer #laravel development #hire laravel experts #find laravel developers #laravel development services india

Seamus  Quitzon

Seamus Quitzon


How to perform migration rollback in laravel

As we know that laravel migration provides very simple way to create database table structure. We need to create migration file and write table structure then migrate that migration. Sometimes we need to rollback that migration. So here we will discuss about the migration rollback in laravel.

We can run the rollback artisan command to rollback on a particular step. We can execute the following artisan command.

php artisan migrate:rollback --step=1

Every time when we will rollback, we will get the last batch of migration.

**Note: **This rollback command will work on laravel 5.3 or above version. For the version below 5.3, there is no command available for migration rollback in laravel.

We can also use the following command to rollback and re migrate.

php artisan migrate:refresh --step=2

It will rollback and remigrate last two migration.

You can also checkout the article for executing single migration by clicking on the link below.

How to migrate single migration in laravel

#laravel #how to perform rollback migration in laravel #laravel migration rollback #migration refresh in laravel #migration rollback batch in laravel #migration rollback for one specific migration #migration rollback in laravel