Author: Justin

Hello Laravel Lovers, some time in our project we have to create an api for getting access often we called as common controller method, for example we have to access category from anywhere in own project, but that is not a good practice, because that API will be access from any where(Out of your URL). So Laravel provides us a way from where we can block the access for API. Its a simple way to block other URL. Open config->cors.php and change ‘allowed_origins’ like below code. <?php return [ /* |————————————————————————– | Cross-Origin Resource Sharing (CORS) Configuration |————————————————————————– | |…

Read More

Hello Laravel Lovers, Today i will show you how we can connect laravel to multiple database . Here i will show you with Mysql , You can also use which one DB you will love. We will do this task in steps. Set .env files For Multiple Database Some changes in config/database.php file Multiple Database Connection with Model Multiple Database Connection with Query Builder Step 1. Setup .env files For Multiple Database set your .env file like the below code. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel_db_1 DB_USERNAME=root DB_PASSWORD= // Database 2 DB_CONNECTION_SECOND=mysql DB_HOST_SECOND=127.0.0.1 DB_PORT_SECOND=3306 DB_DATABASE_SECOND=laravel_db_2 DB_USERNAME_SECOND=root DB_PASSWORD_SECOND= Step 2. Some changes…

Read More

Hello Developers, Today i am working on AWS, I need a database for my project. I think Why use Amazon RDS why not install mysql server on my ubuntu 20.04 system. So in this post i will guide how we can install mysql on Ubuntu 20.04 Default Ubuntu repositories have MySQL 8.0. Which can be installed directly using the package manager without adding third-party PPA. Use the below command to install from ubuntu repositories $ sudo apt-get install mysql-server Press ‘Y’ for any confirmation asked by the terminal. Now your installation of mysql server is done. Its time to set…

Read More

As a programmer i know the importance of Node Js in current scenario. So i am writing this post for all developers who are using ubuntu and wants to install nodeJs. You can install Node Js using three ways Install Node.js from Default Apt Repository Install Node.js from Nodesource Repository Install Node.js using NVM 1. How to Install Node.Js on Ubuntu 22.04 using Default Apt Repository- Ubuntu 22.04 default contains an old version of Node.js. Currently, the repositories contain the Node 12.22.9 version. but Today when i am writing this post, Node current version is 16.14.2 To install Node.js from…

Read More

Hello Developer, Today i have to send billing email to our office client client, so i have to send email with invoice , so i created this, Now i am going to share with you “How can we send email with attachment” Step 1. Install Laravel Application. Step 2. Install the package which will required to generate PDF. composer require barryvdh/laravel-dompdf Step 3. Setup .env file for mail like below MAIL_MAILER=smtp MAIL_HOST=”in-v3.mailjet.com” MAIL_PORT=587 MAIL_USERNAME=”818c68a3719aca963XXXXXXXXXXXX” MAIL_PASSWORD=”8e9fXXXXXXXXXXXXXXXXXXXXXXXXX” MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=”[email protected]” MAIL_FROM_NAME=”${APP_NAME}” Note- Use your email , user name and password. Step 4. Create a controller in my case my controller name is…

Read More

When we are working on Laravel, Most of the Artisan function is run using CLI. if we have to run artisan command on then we can’t run on Shared Hosting, In that case we have to run through Route. In this post i will guide how to create symbolic link on Laravel. It’s a small post , only give you idea how to run Artisan command to storage link from Route. Route::get(‘link’, function (){ \Illuminate\Support\Facades\Artisan::call(‘storage:link’); echo ‘ok’; }); Now just goto your url and run YOUR_URL/link In previous post i write how to clear cache from Shared hosting  …

Read More

This post will help you to find recently modified files in Linux via command line . The find command works with, define duration in Minutes or Days. The minutes are define with -mmin and the days value can be defined with -mtime You can also define the search criteria to find files modified within or before specified duration. For example, to search files modified before, use “+” (positive) with duration (eg: +1, +24 etc). To search files modified within duration use “-” (negative) sign with duration value (eg: -1, -24) etc. Modified within 10 Minutes:- Search all files modified within 10 minutes in the current directory.…

Read More

In this post i will create a form and and upload image, We will do this step by step, Please follow the below steps.. Install Laravel App Put Database Details Install Spatie library in Laravel Set Up Migration and Model Build Controller File Create New Routes Set Up Blade View Files Add App URL Run Laravel App Step 1. Install Laravel App This step we will install Laravel using composer $ composer create-project laravel/laravel SpatieProject Step 2. Put Database Details Open the .env file and update your database details. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=YOUR_DB_NAME DB_USERNAME=YOUR_DB_USER_NAME DB_PASSWORD=YOUR_PASSWORD Step 3. Install…

Read More

First question is in your mind is why we need this Sitemap? let be describe you first, Sitemap ideally is a file that ends with a .xml extension; it is a simple file that contains the important website pages and allows the webmaster to inform search engines what pages are available for crawling. This sitemap file is not just limited to laravel only, no matter what technology you are using but make sure you must generate and add a sitemap xml file to inform search engines. Here we all know about SEO, and this is not just a keyword; rather,…

Read More

Hello, This is the most common problem , when we deployed our Laravel app on Shared Hosting. The command for clear cache using SSH or Terminal is php artisan cache:clear but some times when we are using Shared hosting then we don’t have ssh access . Method 1:- However, if you want to implement something inside the application, you can always use Artisan class. You can call an Artisan command outside the CLI. Create a route inside you routes/web.php. Route::get(‘/clear-cache’, function() { $exitCode = Artisan::call(‘cache:clear’); // return what you want }); Now just call this from URL. Method…

Read More