Saturday, 24 December 2016

Send error to email in Laravel framework 5.3

Generally all errors of laravel are stored in files.
However in some cases you can need to send these error to email for better tracking .
Below tutorial will guide you to do do.
laravel-error
Now we have to open app/Exceptions/Handler.php . Find there ‘report’ function .
Here 1st parameter is path of view file and second parameter is array containing fields and message in closure .
public function report(Exception $exception)
{
    parent::report($exception);

    Mail::send('emails.errorlog', ['e' => $exception], function($message)
    {
        $message->to('contact@websitename.com')->subject('Website error!');
    });
}
Inside resources/views/errorrlog.blade.php we have:
<h3>Error Log Informtion from laravel website:</h3>
<strong>Date:</strong> {{ date('M d, Y H:iA') }}

<strong>Message:</strong> {{ $e-&gt;getMessage() }}

<strong>Code:</strong> {{ $e-&gt;getCode() }}

<strong>File:</strong> {{ $e-&gt;getFile() }}

<strong>Line:</strong> {{ $e-&gt;getLine() }}

Stack trace:

{{ $e-&gt;getTraceAsString() }}

Laravel PHP Framework Training in Delhi/NCR

Laravel is a free, open-source PHP web application framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and its orientation toward syntactic sugar. As of March 2015, Laravel is regarded as one of the most popular PHP frameworks, together with Symfony2, Nette, CodeIgniter, Yii2 and other frameworks. The source code of Laravel is hosted on GitHub and licensed under the terms of MIT License. Taylor Otwell created Laravel as an attempt to provide a more advanced alternative to the CodeIgniter framework, which did not provide certain features such as built-in support for user authentication and authorization

Laravel PHP Framework Course Syllabus of unitedwebsoft.in

1
Introduction of Laravel PHP Framework
- Installing Laravel 
- Artisan CLI ( command-line interface )
- Laravel Directory Structure
- Configuring a new Laravel project
2
Setting up a sample project ' Hello World '
- Artisan command to generate boiler plate code for a controller
- Basic routing
- Call a controller method from a route
- Passing variables from controllers to views
3
HTML Template to Laravel Blade Template
- Template inheritance
- Master layout
- Extending the master layout
- Displaying variables
- Blade conditional statements
- Blade Loops
- Executing PHP functions in blade 
- Displaying Your Views
- Creating and using a basic views
- Loading a view into another view/nested views
- Adding assets
- Integrating with Bootstrap
4
Migrations
- Introduction
- Requirements for running migrations
- Artisan migration command
- Migration structure
- How to create a table using a migration
- Laravel migration rollback
- Database seeding
- Migrations for our project database 
5
Using Forms and Gathering Input
- Creating contact us form 
- Validating user input
- Sending email 
- Creating a file uploader 
- Validating a file uploader
- Creating a custom error message
6
Creating a registration & user login form
- using Artisn command to create inbuilt user register and login system - Authenticating Your Application
- Adding Custom Fields to Registration Form
- Uploading and Cropping an image using Redactor
7
Admin Panel Setup
- Introduction
- Setup Admin Panel using Bootstrap theme 
- Cretae Admin login 
- Creating an admin authentication system
- Encrypting and decrypting data
8
Using Controllers and Routes for URLs and APIs
- Introduction
- Creating a basic controller
- Creating a route using a closure
- Making the controller RESTful
- Using route groups
- Building a RESTful API with routes
9
Eloquent ORM ( Storing and Using Data )
- Eloquent ORM Models
- Naming conventions
- Table name and primary keys
- Timestamps
- Eloquent ORM INSERT, READ , UPDATE , DELETE
- Using models in controllers
- Displaying data from models in views
10
Creating and Using Composer Packages
- Introduction
- Downloading and installing packages
- Using a basic Shopping Cart package in our project
11
Using Ajax and jQuery
- Introduction
- Getting data from another page
- Setting up a controller to return JSON data
- Creating an Jquery,AJAX comment system 
12
Security & Session
- Using Security
- Sessions Effective
13
Laravel Project : News Portal
- Create Database tables for news project
- Create Model for all database tables
- Define Model Relation ex: belongsTo, hasMany
- Setup admin panel 
- Create CRUD for News ,category inside admin panel
- Create controller to display news and category 
- Use laravel built in pagination on news listing page 
- Create comment system using jquery,ajajx 
- Finalizing our news portal project