laravel-query-builder Questions

3

Solved

This is the query for adding fulltext index in MySQL: ALTER TABLE `TableName` ADD FULLTEXT INDEX `IndexName` (`ColumnName`); But How can I use Laravel query builder to add fulltext index?
Dissociate asked 23/3, 2016 at 9:35

2

Solved

I have a query where in I use Eloquent for finding the ID but what I need is to directly subtract inside the eloquent query ? same as in Query Builder, Documentation code $flight = App\Flight::fi...
Jordison asked 27/6, 2019 at 7:1

2

Solved

I am facing an issues in Polymorphic relation where I can not make whereHas to work. Basically I have a "where" condition which i want to apply. The relation code is working fine to return the rela...

2

Solved

I need to write a raw query in Laravel Database: Query Builder, That outputs size of specific table In core mysql query is as following SELECT table_name "Name_of_the_table", table_rows "Rows Cou...
Runt asked 20/2, 2019 at 7:18

3

I'm new to Laravel 4. I have this query: SELECT a.id, active, name, email, img_location, IFNULL(b.Total, 0) AS LeadTotal, IFNULL(c.Total, 0) AS InventoryTotal FROM users AS a LEFT JOIN ( SELECT ...
Mend asked 25/12, 2013 at 14:28

2

I have an application that use 2 databases. I need to create a query that joins a table from one database with a table form another but I don't know how to do that. So, I have a connection name my...
Arella asked 4/10, 2018 at 10:58

1

I have 4 tables. User table: id col1 col2 CoursesAssigned table: id user_id course_id approved CourseInfo table: id parent_id CourseParents table: id start_date end_date I think the ...
Uncaused asked 3/9, 2018 at 11:37

2

Solved

What's the difference between: DB::table('some_table') ->selectRaw('COUNT(*) AS result') ->get(); and: DB::select(DB::raw(" SELECT COUNT(*) AS result FROM some_table")); In the documen...
Steed asked 17/5, 2018 at 19:7

3

Solved

I need to get last 10 records of a table ordered by a data, and reverse them. This is the code before the reverse: $eventi = \App\Model::with('relation_1', 'relation_2') ->orderBy('data_ora'...
Disentangle asked 3/5, 2018 at 10:13

4

Solved

Ok so I'm getting Trying to get property of non-object when I try and get the data from the DB using $settings = AdminSettings::first(); here is the controller code <?php namespace App\Http...
Winnipegosis asked 5/1, 2018 at 17:18

2

Solved

I want to subtract 100 number from credit column in database that is having int data type. I am looking for the way to directly subtract it with some Laravel query. But right now I first get the co...
Thrombus asked 22/11, 2017 at 10:14

3

I wish to make search query by datepicker and select field. How could I get the requests values from below view file to controller? Where could I modify in the code? thanks. index.blade.php <d...

1

Solved

it's a WHY-question, not How-to one:) I have assigned a Query Bulder to a variable $query: $query = table::where(['id'=>1, 'this_version'=> 1]); $versions['slug1'] = $query->select('tour...
Papism asked 8/8, 2017 at 15:43

1

Solved

I want to build a query something like this: select * from users where id=1 AND address="USA" AND (status="active" OR status="pending") how can i do that with laravel query builder? please help...
Truckle asked 27/7, 2017 at 19:38

1

Solved

I'm trying to find a way to search the relationship. So, I have one to one relation (User and UserDetails, where some of the user can be without details). So, the question is... how can I search ...
Rollick asked 17/5, 2017 at 16:10

1

I'm building a Laravel 5.2 application. I have a native SQL Query that need to be translated to the query builder form, I mean, make the equivalent of the SQL query in the Laravel query builder. Ba...
Zeiler asked 23/11, 2016 at 22:35

2

Solved

I have a Many-to-Many-Relationship between the User and the Customview Model: use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { /** * Customview relat...
Degression asked 18/10, 2016 at 9:21

2

Solved

So I'm using Vue 2.0 and Laravel 5.3 to create an application. I've implemented my own sortable table with Vue, using the built-in pagination provided by Laravel. Everything's working perfect -...
Hippocras asked 5/1, 2017 at 18:44

1

What exactly I wanna do is, I want to make dynamic query in laravel 5.3 based on requested parameters , so in request i will get column names then filters for that query and I don't know tables fro...
Geriatric asked 24/12, 2016 at 21:19

1

Solved

im trying to use mysql_num_rows in laravel but laravel says it not the same way like in 'raw php' example: $users = DB::table('users') ->where('username', '=', $username) ->where('pass...
Duffy asked 6/9, 2016 at 20:16

2

Solved

I want to pass variable to wherehas query in laravel.. but getting an error of undefined variable, In method, if has nature then go where has natures equal to $catname... in line no. 4 public funct...
Rasla asked 12/8, 2016 at 9:42

5

Solved

How to change date-format in laravel from "2016-03-12" to "12-Mar-2016" $results = DB::table('customers as cust') ->where('cust.id',$id) ->select("cust.*","cust.cust_dob as dob") -&...
Ellaelladine asked 10/3, 2016 at 6:58

1

Solved

I'm trying to create a database view via a migration in Laravel 5.2 as I need to hand a fairly complex query to a view. I have models / tables for leagues, teams, players, and points. Each one has ...
Methoxychlor asked 1/2, 2016 at 20:50

1

Solved

Below is an excerpt from the Laravel documentation: The whereBetween method verifies that a column's value is between two values: $users = DB::table('users')->whereBetween('votes', [1, 100])-&g...
Mei asked 22/1, 2016 at 15:59

1

Solved

I want to cast orderBy in query builder laravel because my price is varchar type.. so when it's sorting...the result is far from I want... my script like this DB::table('test')->where(...)-&...
Acrylic asked 11/1, 2016 at 2:51

© 2022 - 2024 — McMap. All rights reserved.