New Features in Laravel 5.3

New Features in Laravel 5.3

Laravel 5.3 New Features and Updates

I here list down some features which is announced with Laravel 5.3

Laravel Echo

Laravel Echo using Laravel Spark is one of cool features coming with Laravel 5.3.

As we know Laravel has its powerful event broadcasting system and listening feature you might have used in previous version of Laravel.

Laravel Echo feature is a vast improvement over the event broadcasting system.

With Laravel Echo, it's going very easy to work with web sockets and if you don't know what is the use of WebSockets then i here let you know, WebSockets is useful for you when you want to send some messages to your users.

You must know that WebSockets implementations have three type of channels :

  • Public
  • Private
  • Presence

Laravel Echo provides very neat and clean syntax for WebSockets features like public, private and presence channels.

Releasing the New $loop Variable

Laravel indroduces the new $loop variables with coming features inside a foreach loop.

Here i list down some new $loop variable.

  • index: Manage indexes
  • remaining: It returns the number of remaining item in loop
  • count: It returns the count of items in the loop
  • first: It returns the boolean that means you can check item is first or not in loop
  • last: It returns the boolean that means you can check item is last or not in loop
  • depth: It returns the integer value of depth of the loop.
  • parent: if this loop is within another @foreach loop then it returns a reference to the $loop variable for the parent loop item, otherwise it returns null for a loop with a depth of 1.
  1. @foreach($users as $user)
  2. @if($loop->first)
  3. <p class="first">{{ user->name }}p>
  4. @continue
  5. endif
  6. @if($loop->last)
  7. <p class="last">{{ user->name }}p>
  8. @continue
  9. endif
  10. <p>{{ $user->name }}p>
  11. @endforeach
dimensions, New validation rules for image upload

In Laravel 5.3, you can set new validation rules called dimension.

Here is a list of parameters which you can pass with it :

  • width
  • height
  • min_width
  • max_width
  • min_height
  • max_height
  • ratio
  1. $this->validate($request, [
  2. 'image' => 'dimensions:min_width=200,min_height=200'
  3. ]);

Search (Laravel Scout)

ElasticSearch and Algolia is very popular tool that gets lots of popularity for searching any data.

Laravel 5.3 introduce scout features that is a driver based fulltext search solution which makes very easy to search any data from Eloquent models.

Currently it ships with Algolia.

You will have to pull it with composer to use this package because Scout is a separate Laravel package as others.

Installation

You can install Scout package by running following command :

composer require laravel/scout

Now you will have to add its service provider to provider array in following path config/app.php.

Laravel\Scout\ScoutServiceProvider::class,

After adding ScoutServiceProvider you will need to publish the Scout configuration through Artisan command.

php artisan vendor:publish

Now you can use Scout searchable features in your application but you will need to add its traits Laravel\Scout\Searchable to model you would like to make searchable.

Have a look at below syntax for fulltext search to find any product name with starting 'Expert'.

Product::search('Expert')->get();

You can paginate too :

Product::search('Expert')->paginate(10);

And you can add where clauses too :

Product::search('Expert')->where('product_id',1)->get();

There is an artisan command to manually trigger indexing via CLI.

php artisan scout:import App\\Product
Laravel Mailable : improved way to send emails

I here let you know about mailable class, all of its configuration is done in the build method and within this method, you can call several methods such as from(), subject(), view(), attach().

Laravel Mailable class are stored in the app/Mail directory.

Mailable classes are responsible for handling data and passing them to views.

Click here to know more How to send mail using mailable in Laravel 5.3 with example

Customizing pagination templates in Laravel 5.3

There are so many changes you will find in Laravel 5.3 and i discussed above about changes in Laravel 5.3

In Laravel 5.3, you can easily customize pagination template.

Click here to know more about pagination in Laravel 5.3 Laravel 5.3 - Customizing pagination templates with example

Phone: (+91) 8800417876
Noida, 201301
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort otele gelen escort sapanca escort söğütlü escort taraklı escort
sakarya escort - akyazı escort - arifiye escort - erenler escort - eve gelen escort - ferizli escort - geyve escort - hendek escort - karapürçek escort - karasu escort - kaynarca escort - kocaali escort - otele gelen escort - pamukova escort - sapanca escort - söğütlü escort - taraklı escort
sapanca escort hendek escort karasu escort escort sakarya sakarya escort bayan adapazarı escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort