skip to Main Content

How Laravel ORM query a string field?

$orderId = 319769; $sql = ShipOrderModel::query()->where('order_id', (string)$orderId); // select * from `hr_ship_order` where `order_id` = 319769 $sql = ShipOrderModel::query()->where('order_id', '319769'); // select * from `hr_ship_order` where `order_id` = 319769 $sql = ShipOrderModel::query()->whereRaw('order_id = "?"', $orderId); //select * from `hr_ship_order` where…

VIEW QUESTION

PHP Laravel SQLSTATE[HY000]

I have a some problem... ORM When I use php artisan tinker, use App\Models\User $u = new User(); $u->title = 'sale'; $u->content = 'auto ...'; $u->price = 2500; HERE ARE GOOD EVERYTHING, BUT... when I type command $u->save(); I see…

VIEW QUESTION

Postgresql – Foreignkey Django separator

There is a model: class Categories(models.Model): name = models.CharField(max_length=150, unique=True, verbose_name='Name') slug = models.SlugField(max_length=200, unique=True, blank=True, null=True, verbose_name='URL') class Products(models.Model): name = models.CharField(max_length=150, unique=True, verbose_name='Name') slug = models.SlugField(max_length=200, unique=True, blank=True, null=True, verbose_name='URL') category = models.ForeignKey(to=Categories, on_delete=models.PROTECT, verbose_name='Categoy') I don't understand…

VIEW QUESTION

Mongodb – Prisma @unique null fails validation

I have a schema as follows: model Player { id String @id @default(auto()) @map("_id") @db.ObjectId steam_id String @unique name String level Int @default(1) elo Float @default(1500) games Game[] @relation(fields: [game_ids], references: [id]) game_ids String[] @db.ObjectId clients Client[] user User? @relation(fields:…

VIEW QUESTION

Mysql – Error Code: 1364. Field 'userid' doesn't have a default value

This is the error: java.sql.SQLException: Field 'userid' doesn't have a default value at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130) ~[mysql-connector-j-8.3.0.jar:8.3.0] This is my Entity class: @Entity @Table(name = "users") public class Users { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int userId; } Table: CREATE TABLE `users`…

VIEW QUESTION
Back To Top
Search