Skip to content

Tag: laravel

Database connection not configured

I am currently doing a local project, using MAMP with PHP version 7.4.21 and I can’t seem to run my system because the database is not configured correctly. Here’s my .env and here’s my database.php Answer DB_CONNECTION is the driver that you will use

How to Add data to Database in Laravels

I will to add data to database, but I have an error when I write the code to add data to array, and the error like this, syntax error, unexpected ‘=’, expecting ‘]’ I am using the follwing code: Controller Here’s the view Here’s the route Do you have any solution to this? I…

Validation to check no existing overlaps with previous bookings

I need to validate that a booking doesn’t overlap in date and time with an existing booking and return and error if a booking is overlapping an existing booking. This is the code I have right now but it isn’t working, and when I make another booking that overlaps an existing booking, it is still p…

How to get array in array with laravel and mysql database?

I am using Laravel (PHP) and MySQL for my backend. I am creating methods for setting and getting information from the database. Those information are being send as a json to the frontend. I can send table information like: For this I am using laravel methods like: DB::table(‘user’)->select(&#82…

Laravel – How to display only those Category who have products?

My aim is to not display the category which don’t have any products as of now. I have a drop-down list having all the category (level down to sub-category as well) which giving me the following results. But, I want to achieve following results The database tables are following Category model I have trie…

Laravel: Multilanguage details of a model

I have a model named Point having the following fields: name description lat lng The fields “name” and “description” can be in several languages, so I created two tables for points and their details. There is an index unique on point_id/language. In the model files I have One To Many r…