Questions tagged as 'eloquent'

3
answers

Each returns null in relations laravel 5.4

I have been practicing laravel and there is something that does not work for me and I do not finish understanding or reviewing the documentation. It turns out that I want to call the related objects between tables to get their other da...
asked by 21.07.2017 / 06:44
0
answers

how to create a query in eloquent to show a table with dates in laravel?

What I want to do is a table like this that is painted in excel with a query in eloquent de laravel what happens is that I already try several codes without success the only one that works is the one that I put in the post but only for the sql e...
asked by 25.05.2017 / 05:50
2
answers

Add property to Eloquent object in Laravel

Using Laravel I query a table called Purchasing that extracts the fields purchase_id, product_name, price, purchase_date , and returns them to a json object, everything goes well . What I want to do is add a final property with the average...
asked by 05.07.2018 / 02:29
1
answer

Create a query in Eloquent

How can I convert this query to eloquent (I've tried it and I ask to ask since I have no idea) select id from solicitudes where id not in (select autorizaciones.solicitud_id from autorizaciones)     
asked by 01.03.2018 / 23:07
1
answer

Check between two date with Eloquent time

Hello, I need to make a query between two dates with hours $data = Modelo::whereBetween('created_at', ['2018/11/10 12:00', '2018/11/11 10:30']) ->get(); But when making this query it brings all the results between the dates without takin...
asked by 27.11.2018 / 19:35
2
answers

Avoid loading certain fields of an eloquent query

I am making a query in this way. To load all sales with their respective relationships, It turns out that everything is fine. $ventas = Venta::with(['categoria','user','foto']) ->orderBy('id','DESC') ->where('status','PUB...
asked by 16.09.2018 / 02:26
2
answers

problem when relating to the ORM eloquent de laravel

I am working on an application in laravel 5.5 that works with tabs (personal data) and I have the respective table I also have a table communes that is related to the tabs table is to say a one-to-one relationship a tab can have a commune, I hav...
asked by 28.02.2018 / 20:59
1
answer

How can I insert a sale using Laravel Eloquent?

How can I insert a sale by obtaining an instance of both models: ('departments', 'people'), with relationships of eloquent.     
asked by 01.02.2018 / 21:24
1
answer

Check with a search engine in laravel

I wanted to know if the query is well done Where to find the posts of a blog that contain a word "query": public function search(Request $request) { //guarda la palabra en $query $query = $request->input('query');...
asked by 19.09.2017 / 02:16
1
answer

Laravel show articles ordered

How can I get a quantity of items ordered from the newest to the oldest (currently it appears from the oldest to the newest) in laravel 5.4 in the controller, the function of the home page home is like this: public function home(){ $...
asked by 29.08.2017 / 06:39