Author

Admin

Browsing

Today, We are going to learn how we can find the number between two columns in Laravel. Many times we need to find the number between two columns like from and to. Laravel allows us to write complex MySQL query using DB RAW. Let’s how we can write the query for MySQL BETWEEN Two Columns in Laravel.

MySQL BETWEEN Two Columns in Laravel

Just follow the query for finding the number between two columns.

Also, We can find the number between two column using another way like.

Both queries are working fine with Laravel for finding the number between two columns. I hope the article is helpful to you.

If you face any issue after following the query please write the comment.

By default, WordPress does not allow to add shortcodes in the widget. If you want to enable shortcode functionality for Widget then you need to allow shortcode for widget text. So let’s see how to enable shortcodes in WordPress widget. it’s too easy to allow shortcode in a widget. just follow below steps.

Enable Shortcodes in WordPress widget

Open functions.php  From of your current WordPress theme. Then add the below code at the end of the file.

Now add shortcodes as you want on the widget. The shortcodes are working on Widget.

If you face any issue after adding this code then please write the comment.

Many times we get the jQuery is not defined error in WordPress. We got this error because the jQuery is a conflict with another plugins or theme. We face the jQuery is not defined error in some WordPress site. The same code is working on some other WordPress website. So, How we can solve WordPress jQuery is not defined issue by a single line of code.

WordPress jQuery is Not Defined

Whenever you need to written jQuery code in WordPress. You must follow the jQuery noConflict syntax. If you write your code using jQuery noConflict syntax. Then you never get the jQuery is not defined or $ is not defined error. Your jQuery code is working fine on every WordPress sites.

Write the jQuery code with WordPress jQuery noConflict syntax.

So, Write your jQuery code using the above syntax. I hope that code is useful for you.

If you face any issue after using the above code please write the comment below.

We are going to discuss How to properly use jQuery noConflict mode in WordPress. Because Many times we face or jQuery not found an issue in WordPress. So, Today we are going to learn how to write the jQuery code in WordPress.

jQuery noConflict mode in WordPress

So whenever you need to write the jQuery code in WordPress then you should follow the jQuery noConflict syntax. Just follow the below code for writing jQuery noConflict mode syntax.

 

Now, you can write the jQuery code using $ and jQuery. Now you don’t get the $ or jQuery is not defined error on console.

Still, If you face any issue on jQuery in WordPress please write the comment below.

Today, We are going to learn How to create Category tree from Array using PHP. Many times we need to create the parent and child category tree. Let’s make it easy with a single function. Yes, You can create the parent and child tree from Array using a single PHP function. Let’s follow the function and pass Array for creating parent and child category tree.

Category tree from Array

Finally, Our function is ready Now, you just need to pass the category array-like.

Now, let’s pass this Array to buildTree then check the output.

We got output something like below.

So, Our category tree is ready with parent and child hierarchy.

If you face any issue after using this code please write a comment.

Laravel is the fastest growing PHP Framework and Object-oriented framework and provides a rich library. Laravel provides a best validation library using that we can easily validate the incoming request. Today, We are going to learn about the unique validation of Laravel. Laravel unique validation is preventing from the duplicate value on the database. You can easily check the record is exists on the database or not? Using Laravel unique validation. Many times we need set the unique validation for Email, Phone, Slug, SKU etc…

Laravel unique validation

So let’s see how we can use Laravel unique validation. I want to set the unique validation on the slug field then let’s follow the validation rule.

We set the unique validation on slug field. Slug field is very useful when we are working with Blog, Product etc… module. Now, Laravel check for the slug on the database that the slug exists or not? If the slug exists then Laravel fire validation like”The slug has already existed”. So, it’s too easy to set unique validation on Laravel.

Now, Let’s write the unique validation for edit record. We need to change the validation value when we are working on edit functionality. We need to pass the current active record ID as a parameter on validation. Now, Let’s change the unique validation during edit functionality like.

Now, Let’s assume I want to edit the 7 number product then Laravel fire unique validation query like below.

select * from product where slug = ‘simple-product’ and id <> 7;

Now, Check the unique validation working perfectly with edit record functionality.

If you face any issue on Laravel unique validation please write the comment below.

Nowadays, PHP is a highly used language for Web development. So, Today we are going to learn file upload functionality. PHP file upload functionality is very easy and almost every application has file upload functionality. So, We must have knowledge about How to upload file on PHP. So, let see how to upload a file using PHP programming. You must have some basic knowledge of HTML for creating form.

PHP File upload

First of all, We are going to create the HTML form. So, let’s create the fileupload.html HTML file. Then write the following code.

We are ready with the HTML form. Now, let’s create the PHP code for handling the uploaded file and store it into the directory. First of all, create the fileupload.php PHP file. Then write the following PHP code.

Finally, We are ready with the PHP file upload code. Before, running PHP file upload example please create the uploads directory at the root directory of your project. Then after selecting a file and upload it and check the file is stored on uploads directory.

If you face any issue after following the code please write the comment below. We are always ready for help.

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. How and when you need to clear Git cache. Whenever you want to add any file to Git Ignore file ongoing project at that time you need to clear cache after adding it to ignore. When you think your git is messed up and acting funky at that time you need to clear cache. Just follow below command for git clear cache.

Before, clearing git cache makes sure your code is committed and push to the branch.

Clear Git Cache

If you face any issue after following this steps write below the comment.

In the last example, We learn about single line comment. In this example, We are going to learn PHP multi-line comments. In multi-line comment PHP allow us to write multiple lines as a comment. Every developer must write the comment. So, another developer easily understands the code.

PHP multi-line comments

First of all, We are going to create a new PHP file for multi-line comment example. So, Let’s create a new file at “C:\xampp\htdocs\first\thecodignstuff.php” then write the below code.

Finally, We are ready with a multi-line comment example. So, Let’s run the file and check the output like

Hello World!20

The comments are not visible on output it’s only usable for a developer. If you face any issue on this example write the comment below.

PHP stands for Personal Home Page. PHP also was known as Hypertext processor language. Today, We are going to learn PHP Single Line comment example. Every language provides comment system. A developer must have habits to write down comment before writing the code. So, when another developer starts working or trying to read code his easily understand.

PHP Single Line comment

Every developer must have habits to write the comment. Let’s see, How we can write the single line comment on PHP. So, First of all, We are going to create a PHP file at “C:\xampp\htdocs\first\comment.php” then write the code like

When we run our example our output something looks like this.

Hello World!20

The Comments are not visible to the user. it’s only for developer use. If you face any issue on this example please write the comment below.