php

Using When Condition Inside a query in Laravel

Similar to the previous article I wrote about using the IF condition inside a query (Click Here for the link), I asked Reddit for the best way to handle the query in my previous article and I learned a bunch of ways where we can get the same solution. One of them using the when …

Using When Condition Inside a query in Laravel Read More »

Using IF Condition Inside a query in Laravel

The task for me today was to filter the products as per their status i.e if they are published then their value would be 1 and if they are unpublished then their value would be 0. But I didn’t want to create three queries for them, one for each condition. Therefore, I used the if …

Using IF Condition Inside a query in Laravel Read More »

Check if the checkbox is checked or not.

As per my previos post, what I did was get all the categories, now I wanted to change the categories checkbox status using ajax. For this I had to get the category ID and the checkbox status using javascript. My previous Code What we are doing here is checking if the input class with ‘checkbox_id’ …

Check if the checkbox is checked or not. Read More »

How to compare data in a relationship table with the main table without using more than one loop?

I had this problem where I had to get all the names from one table and get relation from another table and check if the relationship exists or not and if it exists, the checkbox must be checked. Let me clear the problem first. I need to show all the categories of the posts. So …

How to compare data in a relationship table with the main table without using more than one loop? Read More »

php

A function to create slug from the given data in Laravel

Today, I needed to turn my title of the gallery I was making into url slug. So I searched the internet and came across this beautiful function that does so. So how to do this?First get the data. Then add a gallery slug into that data using the above function. For example Don’t forget to …

A function to create slug from the given data in Laravel Read More »