Multi-Language Functionality In Ionic_v2

Multilingual with Ionic

The Multi-language functionality gives you a facility to have your ionic application in more than one languages.

In this part of the blog, we will be going to explain how you can include translations facility to your application.

We use for translation language ngx-translate npm plugin.


It is an npm plugin that is used for translate the language and switching languages.

First of all, we need to install the above mentioned plugin in the application using the below mentioned command.

$ npm install @ngx-translate/core @ngx-translate/http-loader --save

After installing ngx-translate you need to import array in the NgModule of the application.
Below is an example of the app.module.ts file:

import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';

  imports: [
export class AppModule{}

Now after injecting the plugin in the module we must know how to use that in application. First of all we need to create multiple json files for each language that you are planning to have in your application. Let’s say for example, you are planning to have two languages English and French in your application then please create two files at the below mentioned path.

/assets/i18n/en.json and /assets/i18n/fr.json
If the i18n folder is not there then please create it at above-mentioned path and then place the json files under it.

Now let’s have a look at how those files will look like from inside.

en.json file:
    HELLO:"Hello World"
fr.json file:

Now as we are done with the basic setup of multilingual functionality in our application, Let’s implement it in our component. First, include the injections in app.module.ts file


import { NgModule } from '@angular/core';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpModule, Http } from '@angular/http';

export function createTranslateLoader(http: Http) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
  imports: [
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [Http]
export class AppModule{}

After implementing above mentioned code we need to use TranslatePipe and TranslateService to translate the language of view file. The TranslatePipe is an angular js pipe.

Below Example suggest how TranslatePipe to translate the language of application:

<h1> {{ 'HELLO' | translate }} </h1>

Note: Make sure this key of is declared in JSON file otherwise it will not translate the value instead it will directly print the key “HELLO” as it is.

Now let’s talk about the TranslateService, it can be used for both, to change the current language of an app and to translate JavaScript values in an application.

To use the TranslateService in your app you must first import it and set the default language.


import { TranslateService } from '@ngx-translate/core';

    selector: 'page-schedule',
    templateUrl: 'schedule.html'
export class SchedulePage {
    constructor(translate: TranslateService) {

Here, translate.setDefaultLang(‘en’) is set default language and we change here to language as we added to our project.

Hope this blog helped you feel free to share your feedbacks/queries, also need assistance regarding Ionic App Development then get in touch with us.


Basics Of Laravel Security

Laravel Security

  • Security is most important part of the website.
  • Laravel provides different mechanisms to secure website.
  • Its give surety to the users of the website that their data is secured.


  • Laravel implements authentication it’s very simple.
  • The authentication configuration file in app/config/auth.php directory.
  • Laravel give default model as User model which is located in app/models.

Storing Passwords

  • Laravel service provides Hash class for secure Bcrypt hashing
  • make() function will take the value as an argument and will return the hashed value

Verifying A Password Against A Hash:

Checking If A Password Needs To Be Rehashed

Authenticating Users:

  • Another main security feature is authenticating the user and perform some action.
  • When log a user into your application, you may use the Auth::attempt method.
  • When the attempt method is called, the Auth::attempt event will be fired. If the authentication attempt is successful and the user is logged in, the Auth::login event will be fired as well.
  • The Auth::attempt method will take credentials as argument and will verify those credentials against the credentials stored in database and will return true if it is matched or false otherwise.

Determining If A User Is Authenticated

  • If the user is already logged into your application, you may use the Check method:

Authenticating A User With “Remembering”

  • If you like to provide “remember me” functionality into your application then you just pass true as the second argument in the Auth:: attempt method :

Determining If User Authed Via Remember

If you are “remembering” user logins, you may use the viaRemember method to determine if the user was authenticated using the “remember me” for the cookie:

Accessing The Logged In User

When a user is authenticated, you may access the User model/ record:

When authenticated user retrieve user’s ID, you may use the id method:

Validate User Credentials for Without Login

The validate method allows you to validate a user’s credentials without logging into the application:

Logout Logged In User

Manually Logging Users

If you need manually logged in in the application, you may just call the login method:

This is equivalent to logging in a user via credentials using the attempt method.

Protecting Routes

Route filter allows for only authenticated users to access routes. Laravel provides auth

Filter by default:

CSRF Protection

Laravel provides method for protecting your application from cross-site request forgeries :

CSRF Token used Into Form

Validate The Submitted CSRF Token

Avoiding SQL Injection

  • SQL injection vulnerability exists when an application inserts unfiltered user input in the SQL query.
  • By default Laravel protect your query builder and Eloquent with use PHP Data Objects (PDO) class.
  • PDO allows you to safely pass any parameters.


  • In Laravel, it very easy to create, read, and expire cookies with its Cookie class and cookies is automatically signed and encrypted.

Forcing HTTPS when exchanging sensitive data

  • HTTPS prevents attackers on the same network to intercept private information such as session variables, and log in as the victim.

Hope this helps you well, feel free to add your comments/feedbacks and need more assistance regarding Laravel services or OctoberCMS development services, be in touch

How to Make a Website Pixel Perfect

How to Make a Website Pixel Perfect

Check out some tricks for designing testing by using various way with Responsive and Resizing.

  • Fields used in any pages like textbox, radio buttons, drop-down etc. lists should be aligned properly either by Left or Right.
  • Values used As Numeric should be right justified unless specified.
  • Spaces between Each Error or validation messages, Columns, Rows should be consistent for all pages
  • Check for Scrollbar which should be enabled only when necessary…
  • Font Family, size, style and colour for the headline, description text, labels, Input data should be as per the standard requirement. For Testing – Use ColorZilla, WhatFont Add-ons.
  • Text box for Description should be multi-line for the end user.
  • When the fields are disabled it should be greyed & non – clickable.
  • On click on an input text field, mouse arrow should be a cursor.
  • Input values filled by users should be highlighted when there is an error or validation message on page submission. After correcting the errors user should be able to submit the form.
  • Dropdown list options or values are readable and should not be truncated due to field size limit.
  • Page Content should be left justified.
  • The user can select only one radio option and any combination of check boxes.
  • Check design should be compatible in different browsers with different OS.
  • Alignment from top to bottom(Header to footer) and left to right should be proper.
  • Buttons or Links to different pages should be easily visible and consistent on all web pages
  • Hover and select effect on fields, links, button etc. should be consistent and highlight properly.
  • Check Images for the different section should be displayed properly and should resize as per required size for a section.Check by uploading different size of image, Also by Portrait & Landscape images
  • Check editor works as expected with front CSS.
  • Check sections size or Image size using scaling and measurement tools. For Testing – Use PageRuler, Measureit  Add-ons.
  • Check responsive design and make sure website works on multiple devices. Text, images, blocks etc. should not display out of the screen. For Testing: Use Resize Window, Emulator, Device Mode
  • Menus should design properly for responsive or devices and should be consistent on all pages. Also, check Menu in responsive view, it should display with Hamburger icon.
  • Check content should not be overlapped by section or block and should not go outside across the block on devices.
  • Also, We can follow the design testing as per W3C standard format using this, it shows all the errors & warning related to web design service standard.

Add-ons for testing design for different purposes:

  • Responsive Testing – Resize Window, Simulator, Emulator, Device Mode
  • Text, Images, Frames – ColorZilla, WhatFont, Perfect Pixel
  • Section, Image Size – Page Ruler, MeasurIt
  • W3C HTML Checker
  • Javascript errors notifiers

Hope this blog helped you in making your website work flawlessly and you can also refer our website testing blog. Feel free to provide your vital feedbacks, suggestions are welcomed!

Original Post: AddWeb Solution

How to Increase WordPress Site Performance

How to Increase WordPress Site Performance
Nowadays everyone wants the site they are accessing should be faster. No one wants to wait till the site gets loaded. Because of this, it has become a necessity to improve our site performance as much as possible.
To increase WordPress site performance we need to take care of following things from professional WordPress developers:
1) Host
When you selecting any host for your site, you need to keep following things in your mind:
  • Your hosting should be capable to respond quickly. Response time will be vary based on server i.e. server response time of Apache is differ
  • Your hosting should be able to handle multiple requests at a time. It should be slow down while there is heavy traffic.
2) WordPress Theme
  • A theme which you select for your WordPress site is also responsible for the performance of your site.
  • Your theme should be lightweight and quite speedy.
  • The theme should not unnecessary images in theme, all image should be optimized.
  • A number of files should be less to display the page on your site. For that, we need to combine multiple CSS into a single file. The file should be optimized.
  • You should minify your CSS and javascript.
3) Use Effective Caching
  • Caching is the process of storing data in cache memory.
  • Cache is a temporary storage area. Whenever you request for a page first time, it will save it in the cache memory and then second time onwards server will serve this page from a cache memory. By this way, it will save your execution time and network burden of additional traffic.
There are many plugins available for WordPress like W3 Total CacheWp Super Cache, etc.
4) Optimize Images
  • Your site should have a way to optimize an image. If user uploads image with heavy file size, then it will affect your page load time. So as a solution, you should have installed a plugin which will optimize an image to reduce file size not reducing quality.
  • There are many plugins available for this like Wp-SmushItOptimus, etc.
5) Add an Expires Header to Static Resources
  • An Expires header is a way to specify a time far enough in the future so that the clients (browsers) don’t have to re-fetch any static content such as CSS file, javascript, images etc. This will help you to reduce load time for the regular user of your site.
  • You just need to add following code in your root .htaccess file:
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
6) Add LazyLoad to your Image
  • LazyLoad is the process of having only the images visible in the visitor’s browser window, then, when reader scrolls down, the other images begin to load, just before they come into view.
  • As a result, it will increase your page load time as well as it will save your bandwidth because you are loading less data for users who don’t scroll all the way down on your page.
  • There are many plugins available to implement this functionality, like jQuery Image LazyLoadLazy Load, etc
7) Disable Hotlinking and Leaching of Your Content
  • Hotlinking means, you are loading content from another site like google fonts, some images etc.
  • This will increase your bandwidth and page speed.
  • To overcome this situation, load content as much from your site only. Download external content in your site and load it from there.
8) Remove Unnecessary Plugins
Remove all inactive plugins from your site. You should also remove duplicate plugins(more than one plugin for the same purpose).
By doing this it will not load assets( like CSS, js, etc) of that plugins in your page or it will not perform and process which plugins does before page load.
9) Enable Gzip Compression
Enabling gzip compression on your site will dramatically reduce the amount of data sent from your server to the visitor’s browsers, thus increasing the page-load speed.
Hope this blog helps you out. Hire WordPress Developer to improve your WordPress website’s performance.

Building Custom Solr Query

Building Custom Solr Query

Solr search has great performance, is suitable even for use on large commercial websites and supports facets and multi-index searches. What if we want to build your own query or get all indexed nodes programmatically?

Yes, building the custom query for Solr content will solve the problem.

Benefits of custom Solr Query

  1. Reduces load time.
  2. Custom filters.

1. Initialize solr api query using your index name

// To get index field value
$public_index = “Name of your Index”
$index = search_api_index_load($public_index);
$query = new SearchApiQuery($index);

2. Building filter, you can add multiple filters in your query

// Build a filter.
$node_filter = $query->createFilter('AND');
$node_filter->condition('type', 'content_type', '=');
$node_filter->condition('status', NODE_PUBLISHED, '=');

3. Adding filters to query

// Added filter in query.

4. Fetch results of custom query

// Fetch results.
$results = $query->execute()['results'];
$arr_nodes = array_keys(return $arr_node$results);
Hope this helped you to get most out of the system, feel free to share your reviews and Pick the best answer for your requirements.

Original Post: Building Custom Solr Query

Introduction To Bootstrap Paragraph Drupal 8

Bootstrap Paragraph Drupal 8


Paragraphs are one of the modules that make site builder and end users more powerful. Paragraph module does this by replacing one big WYSIWYG with predefined paragraph types. Paragraph module utilizes entity reference field to reference paragraph types. Paragraphs are basically entities so users get control over fields and theming of the paragraph.


Bootstrap is sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. Bootstrap has become one of the most popular front-end frameworks and open source projects in the world.

A combination of these two is “Bootstrap Paragraph” module.

“The Bootstrap Paragraphs module provides a suite of content and layout Paragraph bundles made with the Bootstrap front-end framework.”

Using bootstrap paragraph module, it is very easy to create features like an accordion, modals, tabs, multi-column layouts, and many more things.

The module has multiple dependencies including paragraphs, Entity reference revisionscontact formatter to name a few. The module also needs Bootstrap framework’s js and CSS added in site theme. Installing this module via composer could be beneficial.

Module installation follows a standard process. The module comes with predefined paragraph bundles which can be accessed from /admin/structure/paragraphs_type. These paragraph bundles are divided into 2 main categories:

Content bundles

  • Simple HTML
  • Image
  • Blank
  • Contact Form
  • Drupal Block
  • View

Layout bundles

  • Accordion
  • Carousel
  • Columns (Even, up to 6)
  • Columns (3 Uneven)
  • Columns (2 Uneven)
  • Modal
  • Tabs

Each paragraph type comes with 2 options:

Width and background color

Bootstrap Paragraph Drupal 8

Over 50 background colors are already defined. Empty background classes are also available to customize based on your theme. These classes are :

  • .paragraph–color–primary
  • .paragraph–color–secondary
  • .paragraph–color–success
  • .paragraph–color–info
  • .paragraph–color–warning
  • .paragraph–color–danger

Predefined width options include following:

  • Tiny – col-4, offset-4
  • Narrow – col-6, offset-3
  • Medium – col-8, offset-2
  • Wide – col-10, offset-1
  • Full – col-12

To use these paragraph bundles, an entity reference field referencing to paragraph needs to be added to a content type. This field can have unlimited value to allow site builders to add as many paragraphs as they want. Once set you can start creating content. With this module, you can place a piece of content in your own structured page.

Additional Features

  • Paragraphs and fields are saved in the database. This means that whatever changes are made in them are also in the database.
  • Theme CSS gets precedence over module CSS. You can copy template files in theme from a module and overwrite CSS as you desire.
  • The module can be uninstalled without losing paragraphs and CSS. You need to move all templates and CSS to your theme. Remove “attach_library” calls from template files and call CSS from theme’s library.
  • You can use this module to create reusable paragraph bundles via a module.

To summarize, Bootstrap paragraph module is a suite of Paragraph bundles made with the Bootstrap framework. With this module, you can easily position chunks of content (Paragraph bundles) within a structured layout of your own design.

Hope this blog helped you and explore more about Paragraphs also need assistance for Drupal 8 Services then get in touch with us Feel free to share feedback.

Original Post: Introduction to Bootstrap Paragraph Drupal 8

Understand Laravel Eloquent Relationships

ND- May

Laravel relationship tables are often connected to one another in the database.
Laravel support different types of relationships and it’s easily working and managing data.
Hire Laravel Developer because Laravel provides powerful query builder for the defined relationship for Database tables and relationship Eloquent model provides capabilities for querying and powerful chaining method.

Defining Relationships:-

  • One to One
  • One to Many
  • Many to Many
  • Has Many Through
  • Polymorphic Relations
  • Many To Many Polymorphic Relations

One to One:-

One to One is a basic relation in the relationship of database tables. In this relationship hasOne() method call and return result value :

Understand Laravel Eloquent Relationships
  • In hasOne method first argument passed is the name of the related model. Once a relationship is defined, we use Eloquent dynamic properties for retrieve related records.
  • Relationship model automatically assumes foreign key to id. if we wish to override or pass the third argument to specify your custom key.

    return $this->hasOne(‘App\Demo, ‘foreign_key’, ‘local_key’);

  • Now, we can access Demo model to our Test model. We can define belongsTo() method in Test model for access relationship Demo model.
Understand Laravel Eloquent Relationships

One to Many:-

One to Many relationships is defined in a single model to use relationships other models data.

Understand Laravel Eloquent Relationships
  • This relationship defined to hasMany() method.
  • In this relationship, we can create a relationship in a single model same as One to One inverse model. After defining relationship we can retrieve demo model for the exam.

Many to Many:-

  • Many to Many relations are a little complex to hasOne and hasMany relationships.
  • This relationship is defined by ‘belongsToMany’ method.
Understand Laravel Eloquent Relationships
  • After defining relationship you can access student’s exams using dynamic property exam.
  • You can use chaining query constraints on this relationship.
  • You can simply call belongsToMany() on your related model when inverse of Many to Many relationships.
Understand Laravel Eloquent Relationships
  • In this relationship you can see both models counterpart are same because we are reusing the belongsToMany() on this models

Has Many Through:

  • Many convenient shortcuts are used to access distance relations in this relationship and all convenient shortcuts are provided by Has Many Through relationship.
  • Now, we can define Has Many Through relationship in Demo model.
Understand Laravel Eloquent Relationships
  • In above example first argument and second argument pass in hasManyThrough() method is the name of the final method and intermediate model name.

Polymorphic Relations:

  • Single associated model is allowed to belong more than one another model in Polymorphic relationship.
  • This relation provides a custom Polymorphic relation
Understand Laravel Eloquent Relationships
  • You can register morphMap() in boot function in AppServiceProvider or Create a separate service.
  • The model structure is Build a relationship in Polymorphic relationship.
Understand Laravel Eloquent Relationships
  • The polymorphic relation is a great deal to save time and share particular features.

Many To Many Polymorphic Relations:

  • Many To Many Polymorphic Relation Is defined in traditional polymorphic relations. For example, teacher and exam model is shared a polymorphic relation with a demo model.
  • It can allow you to unique tags in a single list and that shared in teacher and exam models.
  • Model structure of this relationship is based on Eloquent class.
Understand Laravel Eloquent Relationships
  • After that inverse of the relationship of exams model. So you can define its related models and define teacher and test method in below example :
Understand Laravel Eloquent Relationships