Posts by Leonardo • 108 points
7 posts
-
0
votes1
answer60
viewsA: Failure to assign constant value
Man, I’d do it like this: Controller: async create(req, res) { const user = req.body if (!userVal.isValid(user)) { return res.status(400).json({ message: "Dados inválidos" }); } const userCreated =…
-
-1
votes1
answer28
viewsA: JS - How to loop based on data from an array?
This structure you sent should be an array of objects and it’s not, if it were an array of objects it would be something like this that you should do: Its structure: const Boletins = [ { id: 1,…
-
0
votes2
answers113
viewsA: Play date returned from ajax in php foreach
Try to take this JS return and give a json_decode, then you transform to php object and can manipulate in your foreach.
-
4
votes1
answer46
viewsQ: QUERY - Can anyone help me mount this query?
I have these 3 tables below: "users", "Friends" and "posts". I want to take all my friends who are in the table of Friends and display their posts, taking the name of each and their image (which are…
-
2
votes1
answer4203
viewsA: How do I do this query with subselect in the Laravel?
Solved! $posts = DB::table('friends') ->select('posts.dt_hr', 'posts.descr', 'name', (DB::raw("(SELECT u1.name FROM users u1 WHERE u1.id = friends.id_friend) AS name"))) ->join('users',…
-
0
votes1
answer4203
viewsQ: How do I do this query with subselect in the Laravel?
I tried anyway, but he won’t ride for me SubSelect. I used the method toSql() to confirm and really he does not ride. SQL SELECT p.descr,p.dt_hr, (SELECT u1.name FROM users u1 WHERE u1.id =…
-
3
votes1
answer59
viewsQ: How to recover data from php terminal?
Example, I have this command following in a php file: <?php $imprimir = shell_exec("cd /home/afonso/Documentos/teste; git add arquivo.txt; git commit -m 'testando'; git push -u origin master");…