skip to Main Content

Django combine queries with and (&) in m2m field – Postgresql

I have such models: class Post(models.Model): title = models.CharField(max_length=200) content = models.TextField() tags = models.ManyToManyField(to="tag", related_name="tags", blank=True) def __str__(self): return self.title class Tag(models.Model): value = models.CharField(max_length=50) parent = models.ManyToManyField("Tag", related_name="children", blank=True) image = models.ImageField(upload_to="tags", null=True, blank=True) def __str__(self): return self.value…

VIEW QUESTION

How to insert array to db using create Laravel method?

There is a controller method: public function addEducation(AddPatientEducationRequest $request) { dd($request->all()); $state = UserEducation::create($request->validated()); } The dd() returns me an array that I need to insert into db: array:1 [ // appHttpControllersApiPatientController.php:99 "education" => array:1 [ 0 => array:5 […

VIEW QUESTION
Back To Top
Search