Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

How to get the latest and oldest record in Laravel Eloquent through ofMany.

Laravel ships with many awesome and time-saving methods for developers like us.. Here we will see some “One of Many” function’s examples:   Get the latest/last record from a model/relation function latestRecord() { return $this->hasOne(RelationModel::class)->latestOfMany(); } Get the oldest/first record from a model/relation function latestRecord() { return $this->hasOne(RelationModel::class)->oldestOfMany(); }   Bonus!: Retrieve records with special […]

Copy or duplicate a row in Laravel project

I have been working on an application named “EasySME” with Laravel & MySQL. And a client requested a new feature that he wants to clone/copy/duplicate the existing Invoice. So, I have done a few searches and R&D and found out that Laravel ships with a built-in function called replicate(). Laravel is awesome, you want it […]

How to get or export SQL query from Laravel migration file?

Hey there.. hope you are facing the same problem as I am facing to update the DB from phpMyAdmin.. and no ssh access from Cpanel to run the migration command on the terminal. And you are in the right place.. here is the solution to get the dump query from the Laravel migration file. Command: […]

Validate Bad Email Address in PHP, Laravel

Hey! what’s up? I am working on a SAAS application for my current company and facing the issue of sending emails, actually bad emails, those comply with the RFC. So that means basic email validation is not working from the Laravel side and we are processing emails to ‘example@gmail’ like email addresses (yes RFC allow […]

Change or set php-cli version in Ubuntu

Hey, So you also face the same issue! Hope you will get a solution here.. BOL! Check the current PHP version.  php –version In my case, it is php7.1. Now, check the excepted version that you want to set/change in folder ls -la /usr/bin/ You will get a list of files and folders, now check […]

Send email using Gmail SMTP in Laravel 5.*

Hi there, hope you are not in trouble with your application email sending feature. I am using mailtrap.io for email testing on the development server. It is good, but one problem is all email are going mailtrap’s Demo inbox, not to users individual email. And my client wants to check all email templates and functionality […]

Rapid or fast development in Sublime Text 3

We, developers like to write codes, but what if you need to write 1000000000 lines of code? Let me know your answer on comment 😉 Here comes snippet, What is snippet? Snippet a small piece or brief extract. it’s a brunch of code that is generate by shortcut key. Now we know create some snippets […]

External API calling in Laravel by Guzzle Package

Recently I am working on a project that need to access some external API. And it’s a Laravel project, so I am looking for some package that can save my time and meet the deadline too.   I am using GuzzleHttp package for accessing external API and its really easy   Installation: composer require guzzlehttp/guzzle:~6.0 Uses: […]

Wordpress Social Share Plugin powered by Ultimatelysocial

Remote PHP, Laravel, LAMP developer experience in Oracle Service Cloud

Hi, You can subscribe to get emails
about technology hacks, tools and many more.