Skip to content
Advertisement

Tag: orm

Undefined variable: users (View: /home/laravel/web/laravel.swt101.eu/public_html/abonamenty/resources/views/products/edit.blade.php) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 year ago. Improve this question

How to make generic SQL heredocs?

I’m making a mock ORM in Ruby, storing ‘forum’ data. I have the following tables: users (id, fname, lname), and questions (id, title, body, author_id). a_user.create and a_question.create are more or less the same: I’m writing another class, ModelBase, and I’d like to be able to say something like or . Users and Questions do not have an id until

SQLAlchemy – How to count distinct on multiple columns

I have this query: I’ve tried to recreate it with SQLAlchemy this way: But this translates to this: Which does not call the count function inline but wraps the select distinct into a subquery. My question is: What are the different ways with SQLAlchemy to count a distinct select on multiple columns and what are they translating into? Is there

Syntax message in sql

I have a problem i don’t realy know how to fix, I took this sql when i exported my database in localhost, but when i try to create the User Table for my site in Production i get this Error message. I thought it was because je ‘Json’ format for the ‘role’ but when i change it to ‘array’ i

How to translate millis to date and group by month and year in Jooq?

I have the following SQL which works as expected: I’m trying to recreate these SQL in Jooq, but I don’t know how to create a Date object from the milliseconds I have as creation_date in my database. Answer A common confusion when writing SQL GROUP BY is the logical order of SQL operations. While syntactically, SELECT seems to appear before

Laravel Eloquent: select records where one field equals another

I apologize if this is duplicated. Is it possible in Eloquent ORM to select records where one field equals another? In MySQL this means: Is it possible to do so in Eloquent or I’m bound to using raw queries? Answer On field equalling another in the query builder (and eloquent) is whereColumn(‘Url’, ‘LIKE’, ‘ModelId’) but since you have additional things

Laravel Eloquent version of “NOT IN” SQL

Just need the Eloquent ORM format of this query.. giving a headache for a while. Answer You Can Try this. First you Can Select all Player IDs. $player_ids = TeamRequest::select(‘player_id’)->get(); Then you can find Players Player::whereNotIn(‘user_id’, $player_ids)->get();

Create SQL Server table from user-defined class [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last month. Improve this question I am creating a mini-ORM to learn reflection better in C#. Also I want to use Native & Pure C# and do

Advertisement