Questions tagged [lucid]

Lucid is the AdonisJS implementation of the active record pattern.

Lucid is the AdonisJS implementation of the active record pattern.

If you’re familiar with Laravel or Ruby on Rails, you’ll find many similarities between Lucid and Laravel’s Eloquent or Rails' Active Record.

Lucid documentation

62 questions
7
votes
1 answer

AdonisJS - How to return validation messages according to the locale of Antl Provider

I'm applying internationalization to my API and I'm having some issues related to Antl and validation messages. With standard response messages, I'm returning according to the locale set by the user. I created a route to switch locales and set to a…
Laura Beatris
  • 1,782
  • 7
  • 29
  • 49
4
votes
1 answer

Adonis JS v5 relationship missing model attribute

I am learning how to use the Adonis framework (v5) and as the tradition dictates it, I am creating a todo list api to test it out. The problem I am having is regarding the relationship between the User and Todo entities. Here are the two models: //…
AmiralBl3ndic
  • 406
  • 5
  • 13
4
votes
0 answers

How to import a keras model into lucid

The short version: I would like to visualize a keras model in lucid, and fail to transform the model into a format lucid would accept. The long version: I would like to play around with lucid exploring a simple model built in keras (CNN for MNIST…
Peter
  • 41
  • 1
3
votes
1 answer

How to give a unique constraint in lucid model, I am using lucid in adonis with typescript

In adonis.js i am trying to add a unique constraint to email field just like we do it in sequelize,prismajs or any other orm.Is it posible to add in adonis. import { DateTime } from 'luxon' import { BaseModel, column, computed, HasMany,…
Mradul Jain
  • 62
  • 12
3
votes
1 answer

How to calculate the 3x3 covariance matrix for RGB values across an image dataset?

I need to calculate the covariance matrix for RGB values across an image dataset, and then apply Cholesky decomposition to the final result. The covariance matrix for RGB values is a 3x3 matrix M, where M_(i, i) is the variance of channel i and…
ProGamerGov
  • 870
  • 1
  • 10
  • 23
3
votes
1 answer

How to use Lucid Interpretability tools on a Tensorflow Detection model?

I want to use Lucid to analyze the feature extraction of a detection model I trained using the tensorflow Object Detection API on my own dataset. The model used is one from the Tensorflow Object Detection Zoo, namely faster_rcnn_resnet101. I…
2
votes
3 answers

Adonis 5 how to get pivot_column from $extras and inject into preload

I created an extra column on my manyToMany decorator and know how to preload my data based on its value. my question is how can I actually take that value and insert it to it's relevant preloaded data or insert them into a new array on parent model,…
w3bsite
  • 181
  • 1
  • 10
2
votes
1 answer

How to use Hash.make(user.password) in adonisjs

Trying to encrypt a user password using Hash.make(user.password) from import Hash from '@ioc:Adonis/Core/Hash' The problem happens when the code tries to execute the Hash.make present inside @beforesave it gives me a referenceError. message:'Hash is…
Cesarvspr
  • 301
  • 3
  • 9
2
votes
0 answers

Many to Many query on Lucid models, AdonisJs

Consider a simple situation of users and subjects related with a pivot table named user_subjects, now if I have to fetch all the users who have opted for a certain subject. What is the best way to achieve this in AdonisJs 5. Following is the…
Kushagra Saxena
  • 671
  • 5
  • 17
2
votes
1 answer

Adonis.js : How to select some attribute in query using Lucid Models

I wanna select some attribute in my query. This is my code in controllers const Category = use('App/Models/Category') class CategoryController { async getCategories({request,response}) { try { let categories = await…
atjab
  • 127
  • 2
  • 16
2
votes
2 answers

How can I automatically append a property from a relation to the root object?

How can I automatically append a property from a relation to the root object, as if it were a column from the same table but actually it is coming from another table. Supose I have an User model that hasMany Emails. How can I only append the email…
Eleandro Duzentos
  • 1,370
  • 18
  • 36
1
vote
0 answers

Group users by month for last year in Lucid

I am working on a project on AdonisJs and Lucid ORM where i need to show a chart with user registration count grouped by every month (created_at -> month name) for the last year. I did this query in Laravel eloquent but didn't find a solution for…
1
vote
1 answer

AdonisJS hasManyThrough through a hasOne

I have the following models: Usuario has many RolesUsuario belongsTo Rol I want to setup a hasManyThrough in Usuario so that I can access the list of roles for a user with a simpler preload. The documentation for the hasManyThrough doesn't fully…
Leticia Esperon
  • 2,499
  • 1
  • 18
  • 40
1
vote
1 answer

how to get relationship data in adonis js

I have a relational model in adonis that I want to retrieve the data (Post belongs to Category). I've set up the relationship in both of migration and model, But when I try to get the category name from the first Post with const posts = await…
1
vote
0 answers

adonis 5 computed column on pivot-table

I understand we can add additional columns on pivot tables when using manyToMany decorator on a lucid model: @manyToMany(() => Skill, { pivotColumns: ['proficiency'], }) public skills: ManyToMany I wanted to know if it is possible to…
w3bsite
  • 181
  • 1
  • 10
1
2 3 4 5