moprocto

moprocto

Member Since 4 Years Ago

Experience Points
4,800
Total
Experience

200 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
4,800 XP
Jul
20
1 month ago
Activity icon

Replied to Get Distinct Associative Arrays Based On Matching Value Pairs

I followed your advice and revised my architecture. It's significantly faster and easier to work with, thanks!

Jul
13
2 months ago
Activity icon

Replied to Get Distinct Associative Arrays Based On Matching Value Pairs

I agree with you! I'm thinking about redoing my architecture to create a separate table for conversations OR use a third-party system altogether. At first, I didn't find conversations necessary there are only two people in a conversation (which is long-lasting). I'm definitely using way too much memory as things are currently. I'm going to see how far I can get with your recommendations!

Personally, I'm finding https://firebase-php.readthedocs.io/en/stable/realtime-database.html difficult to use because I don't see documentation to help me build complex queries. That is another topic altogether!

Jul
12
2 months ago
Activity icon

Started a new Conversation Get Distinct Associative Arrays Based On Matching Value Pairs

I have a messaging system in my app and I'm pulling my hair out trying to figure out the best way to give the user a menu to select which conversation they want to read. I'm trying to mirror the GroupMe style menu where on the left are your conversations. This conversation list is dynamic so the most recent conversations are at the top and update while you are using the app.

I'm using Laravel 7 and Firebase

Here's the data from my backend (prettified)

Array
(
    [-MC1kTfrrDHY3ZbidJ4Q] => Array
        (
            [from] => lSUfZ4sgEJd
            [message] => test message four no more!
            [startedAt] => 2020-07-12 11:21:10
            [to] => CWgPqdn3YweN
        )

    [-MC09BsjtXP0izITsThf] => Array
        (
            [from] => CWgPqdn3YweN
            [message] => test message three
            [startedAt] => 2020-07-11 11:20:19
            [subject] => -MC00BHCZlXUp25C5nlS
            [to] => lSUfZ4sgEJd
        )

    [-MC1kAi1niswXtjY_h4s] => Array
        (
            [from] => CWgPqdn3YweN
            [message] => test message two
            [startedAt] => 2020-07-12 11:19:52
            [to] => lSUfZ4sgEJd
        )

    [-MC1kOtfnIlAYtmJsD-a] => Array
        (
            [from] => CWgPqdn3YweN
            [message] => test message one
            [startedAt] => 2020-07-12 11:18:50
            [to] => lSUfZ4sgEJd
        )
     [-MC1kOtfnIlAhgcufu] => Array
        (
            [from] => CWgPqdn3YweN
            [message] => test message zero
            [startedAt] => 2020-07-12 11:00:50
            [to] => YLisXjk07w93
        )
)

I want to get the latest, distinct conversations no matter if I'm the sender or receiver. The end result I want will look like this

Array
(
 [-MC1kTfrrDHY3ZbidJ4Q] => Array
        (
            [from] => lSUfZ4sgEJd
            [message] => test message four no more!
            [startedAt] => 2020-07-12 11:21:10
            [to] => CWgPqdn3YweN
        )
 [-MC1kOtfnIlAhgcufu] => Array
        (
            [from] => CWgPqdn3YweN
            [message] => test message zero
            [startedAt] => 2020-07-12 11:00:50
            [to] => YLisXjk07w93
        )
)

Anybody mind providing guidance on this? I have tried following along with responses on StackOverflow https://stackoverflow.com/questions/25561707/get-unique-value-of-one-attribute-from-array-of-associative-arrays but I lose the $key of the array, which is the ID of the message.

May
05
4 months ago
Activity icon

Replied to Simplest Way To Convert "Zulu" Time With Carbon And Laravel?

It's technically just a helper function I'm using, but pasted below!

<?php

use Carbon\Carbon as Carbon;


function convertTimeStamp($stamp){
    return Carbon::parse($stamp)->setTimezone('UTC');
}

Activity icon

Started a new Conversation Simplest Way To Convert "Zulu" Time With Carbon And Laravel?

I'm working with an API that provides timestamps in formats like this 1998-05-04T23:16:01.000+00:00 I did some research and it appears this is referred to Zulu time. When I use Carbon, it throws an error

$date = Carbon::parse('1998-05-04T23:16:01.000+00:00')->setTimezone('UTC');
echo $date;

error

Facade\Ignition\Exceptions\ViewException
DateTime::__construct(): Failed to parse time string (1588553042950) at position 12 (0): Unexpected character 

I am using Laravel 6.18.13