Question: You think it would be slow?

Asked By
invulsion
Asked At
2017-09-21 18:32:20

Found 15 possible answers.

User Answered At Possible Answer
dylan.dpc 2017-09-21 18:32:22 that's your business logic that depends.. you could index columns in your tables and gain some speed
invulsion 2017-09-21 18:32:49 I just got to know about flatMap honestly
dylan.dpc 2017-09-21 18:33:02 :slightly_smiling_face:
invulsion 2017-09-21 18:33:44 Will take a look. Thanks buddy!
tasioleiva 2017-09-21 19:54:51 Hi all, I'm making a social network with a simple facebook-like friendships system. With my authorised user, I want to return all its friends (who have sent to or received from a friend request and has been accepted). I'm having a really hard time finding the way to do this correctly, for now I have everything working if I call the friends() method, but I'm unable to append it to the user model as if it was part of it (to serialize it all and use it with Vue, also to be able to optimise it in the future with eager loading). A few screenshots of the code here: https://imgur.com/a/6q4PI Any help will be extremelly appreciated. Thank you!!
dylan.dpc 2017-09-21 19:55:07 what issue are you facing?
tasioleiva 2017-09-21 19:57:41 basically every time I use the attribute accessor and add 'friends' to the $appends attribute, if I reload the page I get a error 500 Maybe I should be using a different kind of relationship to make this simpler? @dylan.dpc no exceptions, no nothing, the execution halts and I get the default chrome error page
dylan.dpc 2017-09-21 20:06:56 check why you are getting the error check your :logs
tasioleiva 2017-09-21 20:07:50 Good call, I was so stuck that I didn't even think about the log. Give me a moment @dylan.dpc nothing on the logs...
dylan.dpc 2017-09-21 20:12:08 are you sure you have setup your server properly?
tasioleiva 2017-09-21 20:14:41 yes, everything works fine and I have never had this problem before I even tried on two computers
rojtjo 2017-09-21 20:15:36 @tasioleiva moving the $this->friends() call in your getFriendsAttribute() accessor into a try/catch block and dump the exception happening
tasioleiva 2017-09-21 20:16:05 @rojtjo doing that right now
rojtjo 2017-09-21 20:16:22 Might be useful to catch Throwable if on PHP7+
tasioleiva 2017-09-21 20:17:43 @rojtjo nothing happens, I get the exact same error. I tried catching \Exception and \Throwable it's like the server dies, but I know for sure the server is working perfectly

Related Questions