Using non-standard primary key with Eloquent relations (Laravel 5)

In my experience of using PHP web frameworks, Laravel is one of my favorites. Laravel helps faster development as well as much more simple to work with and feel very familiar if you are coming from frameworks such as Symfony.

The Eloquent ORM is one of the many things, that makes Laravel smarter. It makes simple for many developers to play with database. All these ease come with the standard pattern which recommended. If for some reason, you need a customized database design, it comes with a small cost, where you need to setup few things (Yet, it is far simple than many other frameworks do).

On one of my past works, I was having some difficulties in working with relations in Eloquent. It was because, I was using a non-standard primary key and column type.

Below is the model of my tables.

The table, ‘device_models‘ is using a primary key that is type of ‘varchar’. In standard Eloquent way of relation, it is expecting to be an ‘increment’ column type which will end up in ‘unsigned int’ in MySQL. To make this primary key compatible with Eloquent relation, you need to set additional three fields in class definitions.

  1. protected $primaryKey = ‘device_model’;
  2. public $incrementing = false;
  3. public $keyType = ‘string’;

These additional fields tell Eloquent that, the standard way of implementation is changed a bit, and please use these values instead. In addition to these properties, you need to pass the primary key field name in the function which creates the actual relation. Or else Eloquent will automatically adds _id

The complete migration and Eloquent model are presented below.

Migration for table ‘device_models’


Migration for table ‘profiles’

Eloquent model ‘Profile’


Eloquent model ‘DeviceModel’


Leave your comments below!!!

Resolve Google play service issue in Samsung Galaxy Note 3

Resolve ‘Your device is not compatible with this version’ issue of Samsung Galaxy Note 3 while installing Google play service on Lollypop update


It looks all the forums are flooded with this question. It usually happens after factory reset of a Samsung Galaxy Note 3 after Lollipop update. Same like to many other, it happned to me as well. It might be a Samsung bug as it seems to be reported only from Galaxy Note 3. I am sorry for blamming Google at the begining. 😀

The simplest solution is to download the Google play service APK from and external source and install it manually. To install it ..

  1. Download the Latest APK v9.2.56 from an external link.
  2. Enable “Unknown sources” from ( Setting -> Security -> Unknown sources ) your Note 3
  3. Copy the downloaded APK to your mobile storage.
  4. Open and Install.

Done !.

Please try this and let me know your comments. Thanks.

Disable error reporting | PHP

This function is sued for setting the error reporting level at runtime. To completely disable error reporting, the value is ‘0’ zero.



Other kind of error reporting levels

Using combinations of error levels



Modern Free Fonts for Graphic and Web Designers

100 Greatest Free Fonts for 2016


They make some little contribution in New Year 2016, by gathering 100 free fonts for you. They hope these fonts are very useful to create some great project in 2016. Enjoy!

Link to Download

The 100 best free fonts

The best free fonts, from vintage-inspired typefaces to slap-you-in-the-face slab serifs, for Windows and Mac, for a range of projects.
This list represents the 100 best free fonts we’ve found in a variety of styles. Some of the typeface collections listed here can be used on your web projects, but please be sure to check the terms

Link to Download

100 Greatest Free Fonts Collection for 2015


The 2015 version of The 100 Greatest Free Fonts Collection is finally here.

Regarding their licenses, you should pay attention to each one individually as, while the majority are completely free, some are for personal use only and others are not full families – this means that you’ll only be able to download regular or medium weights or condensed styles for free.

Link to Download

45 Best Free Fonts for Designers


Free highest-quality best fonts for designers, commercial-use fonts, typefaces and typography for free download. These free fonts are design friendly which stand in a unique class of their own. In this post we are gathered some of best free fonts for designers. Download them instantly and start using in your design.

Link to Download

100 Free Fonts You Should Be Using In 2015


Here at this post, they know how difficult and time-consuming it can be to search for the perfect fonts every time you need one for a design project. So they have done the hard work for you, compiling a showcase of the best typefaces from 2015 and recent years.

Link to Download

16 New Futuristic Free Fonts for Designers

Fresh free fonts for 2016 is here. There are high-quality fonts; all of these come in regular, rounded and italics respectively. Highest-quality fonts can significantly improve your design by simply included them in the project you are working on. You can use these fonts to create modern style logos, tattoos, badges, emblems, headings, posters, Packaging, t-shirts/clothing, greeting cards, and wedding invitations, etc.

Link to Download

Convert NMEA (latitude, longitude) to Decimal

The below code snippet shows, how to convert latitude and longitude gained from an NMEA sentence into decimal format.







OpenWRT 15.05 patch for ZBT-WE826 and ZBT-WE1026

Patch for ZBT-WE826

This patch is applicable to ZBT-WE826 and compatible with ZBT-WE1026 boards.

Download Patch

OpenWRT Version : 15.05

How to apply






Using PDO::fetchAll – Examples with codes and output results

PHP Data Objects (PDO) as an abstraction layer used for accessing databases. It makes life easier while working with databases oriented applications.
There are several fetch modes available with the library which help us through the development and it would reduce a lot of custom coding if we know exactly how to use them.

We will discuss some of them.

(PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)

PDOStatement::fetchAll — Returns an array containing all of the result set rows




Returns the indicated 0-indexed column.

Example result:

Sample code:



returns an array indexed by column name as returned in your result set

Example result:

Sample code:



Specifies that the fetch method shall return each row as an array indexed by both column name and number as returned in the corresponding result set, starting at column 0.

Example result:

Sample code:



Fetch a two-column result into an array where the first column is a key and the second column is the value

Example result:

Sample code:



Groups the result by the first column.

Example result:

Sample code:



Specifies that the fetch method shall return a new instance of the requested class, mapping the columns to named properties in the class.

Sample code:

Example result:


EzeInput Jquery plugin

This is a type of mention input powered by jQuery. I started this code for one of my application project and later thought to compile as a separate project and to opensource it. I welcome your feedback and suggestion for the improvements. Thanks for reading this post and using ezeinput jquery plugin.

This plugin takes input from you and display themed separated by a given separator. There are different options to configure.

Demo :

Download form


jQuery library


Link the style sheet at the header section

Attach the jquery plugin. Usually before the body close tag is more preferable.

Installation Script







Get Values

Returns a JSON object of the input values.


clear Values



Please go to Github project page for download

Installing Kubuntu Desktop (KDE) on Ubuntu 14.04LTS

KDE is probably the best looking environment around, and it has a very cool widget-based desktop built in to the environment. Its menus are set up very much like Windows, with one main menu located in the bottom left corner of the taskbar from which you launch apps and view settings.

Installing KDE

The following lines explain how to install KDE desktop on Ubuntu Linux 14.04 LTS.

KDE Screenshot

Installing Kubuntu Restricted Extras

The Kubuntu Restricted Extras will install Adobe Flash Player, Java Runtime Environment (JRE) (sun-java-jre) with Firefox and Konqueror plug-ins (icedtea), a set of Microsoft Fonts (msttcorefonts), multimedia codecs (w32codecs or w64codecs), mp3-compatible encoding (lame), FFMpeg, extra multimedia codecs for K3b, the package for DVD decoding (libdvdread3), the unrar archiver, odbc, and cabextract. It also installs multiple “stripped” codecs and avutils (libavcodec-unstripped-52 and libavutil-unstripped-49).


KDE Screenshot 2.

Creating a VLAN with Oracle virtual box

Same like many other Vms, Oracle virtual box also supports creating a VLAN. To do this first we need to understand the different types of networ types in Virtual Box.

  • Not Attached
  • Network Address Translation (NAT)
  • NAT Network
  • Bridge Network
  • Internal Network
  • Host Only Network
  • Generic Network

I do not want to repeat the details of all about network types. If  you are concern about it, please refer to this link ==>> (6.2. Introduction to networking modes)

Each different types os networking methods can be used to achieve different kinds of tasks. In our case, we would use “Internal Network”. This will help us create VLANs by names.


Steps :

  1. Go to settings, Click on “network” tab
  2. Click on “Enable Network Adapter” in one of the adapter tab.
  3. In “Attached to” select box, choose “Internal Network”
  4. For the name input box, provide a VLAN name if you do not have already one. It is your choice.


The below screenshot will describe you more.

Oracle Virtual box VLAN Configuration

Oracle Virtual box VLAN Configuration