In this guide, we’ll dive into get single column value in Laravel Eloquent ORM. In Laravel development, optimizing database queries is pivotal for creating efficient and high-performance applications. This technique is valuable for extracting targeted data from your database, enhancing the precision and speed of your application. To illustrate get…
Tag: mysql
How to Fetch Records Between Two Date Range in Laravel ?
Many times we want to fetch records between two date range in laravel like find all records which is created between start yesterday and end today so in that case we need to check it with created_at columns in database but created_at column also has time and if we directly…
How to Concat Two Columns in Laravel Eloquent Query With Search ?
In this article we will learn to use aggregate function concat in laravel eloquent with search and query builder. Concat is used to join two columns and in laravel eloquent there is no method for concat but we can use DB builder to use native MySQL Methods. In MySQL or…
How to Reset Root Password of MySQL 8 in Ubuntu 20.04 ?
Sometimes we forget or mistakenly type wrong password during the installation of mysql, So in this article i will help you to Reset Root Password of MySQL in Ubuntu 20.04. Mysql 8 has several new features and also it has change the default password algorithm for saving the password. Mysql…
How to Use hasOne Relationship in Laravel with Example ?
hasOne relationship in laravel is used to create the relation between two tables. hasOne means create the relation one to one. For example if a article has comments and we wanted to get one comment with the article details then we can use hasOne relationship or a user can have…
How to Use hasMany Relationship in Laravel with Example ?
Laravel hasMany relationship is used to create the relation between two tables. hasMany means create the relation one to Many. For example if a article have comments and we wanted to get all comments of the article then we can use hasMany relationship . Database Relations are used to create…
How to Use Laravel belongsTo Relationship in with Example ?
Laravel BelongsTo relationship is used to create the relation between two tables. belongsTo means create the relation one to one in inverse direction or its opposite of hasOne. For example if a user has a profile and we wanted to get profile with the user details then we can use…
How to run raw query laravel eloquent ?
Sometimes in laravel we wanted to run raw query like select, insert, delete, alter etc. Laravel have multiple ways to run a raw query using select, prepare or statement method in db builder. In this article i will show you to run the raw query in laravel. To understand this…
How to use left join in Laravel eloquent query with example
In this article we will learn to use left join in laravel eloquent and query builder. Laravel itself provide inbuilt method to left join the table like in MySQL or SQL based database we can do join multiple tables using leftJoin function. For example if you have 10 rows and…
How to compare date in where query laravel eloquent
Laravel use carbon library to format and show the date and to compare date in where query laravel or db builder it uses carbon internally so compare date in where query in laravel is almost same as executing where using other data type but if we wanted to go more…