How to get Data First microservice to another microservice ?

In this tutorial we’re going to learn how to get value in first microservice to another microservice in laravel . So follow this tutorial in this tutorial i have mentioned in very easy way.

1st step create model

php artisan make:model Webdata
namespace App;
use Illuminate\Database\Eloquent\Model;
class Webdata extends Model
    protected $connection = 'mysqlProjects';
    protected $table = 'projects';

Next go to first microservice config/database.php and put code as like below.

'mysqlProjects' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST_PROJECTS_COUNT', ''),
            'port' => env('DB_PORT_PROJECTS_COUNT', '3306'),
            'database' => env('DB_DATABASE_PROJECTS_COUNT', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,

Next go to first microservice .env file and put code like below


Now you’ll get the data as like below code

$projects = Webdata::where('project_name', $request['project_name'])->where('slug_id', $request['u_org_organization_id'])
        log::info('check kro project data me kya aa rha hai'.$projects);
        $slug_id = $projects->slug_id;
Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

How to use multiple database in Laravel ?

In this tutorial i’m going to learn how to configure multiple database from one project to another project so follow this tutorial i have mentioned in very…

How to Use Fail2ban to Secure Your Server ?

What is fail2ban ? Fail2Ban is like a bouncer for your server. It’s a security tool that helps protect your system from brute-force attacks by monitoring log…

What are the use of this command sudo ufw allow 443 ?

The command sudo ufw allow 443 opens port 443 in the Uncomplicated Firewall (ufw). Port 443 is the standard port used for HTTPS traffic. This means that…

What is Model ? Object Model in JavaScript ?

What is Model ? A model is a representation of a real-world entity or concept. It can be used to describe the structure and behavior of the…

Top DevOps Trainers in the world

There are many reasons why we need the best DevOps trainers. DevOps is a complex and ever-evolving field, and it can be difficult to stay up-to-date on…

Top 15 SEO & Digital Management Software in 2024

Here is a list of the top 15 SEO & Digital Management Software in 2024, including : These software solutions offer a variety of features to help…

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x