petritr

petritr

Member Since 1 Year Ago

Experience Points
29,090
Total
Experience

910 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
170
Lessons
Completed
Best Reply Awards
5
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 6
29,090 XP
Oct
29
2 weeks ago
Activity icon

Replied to Return Popular Cities

Something like this:

->with([
             'users' => function ($user) {
              $user->whereNotNull('id');
       }
])
        ->get()
Oct
21
3 weeks ago
Activity icon

Replied to How To Delete DOM Element In Vue Js ?

@atfinho you need to check if the option that you deleted its still in the internet component select object, can you send copy of the this.cities array ?

Sep
17
1 month ago
Activity icon

Started a new Conversation Storing And Delaying An Transaction

Is there a way to store the transaction and wait for an user confirmation ? If the confirmation is true then execute the transaction?

Something like send an warning and wait for confirmation

Sep
11
2 months ago
Activity icon

Started a new Conversation Laravel Model Observers & Relations

Is it a good price to use Observers to check when an relationship HasMany is created? My goal is to know when an relationship is created so i can check the other Model and update it with the relation data.

I want to Observe when Users has and Job Relation created, with the Job data i can check if Position Model has this new Job

Any suggestions ?

Sep
08
2 months ago
Activity icon

Started a new Conversation Group Nested Array By Same Value

I have an nested array like this:

array:4 [▼
  0 => array:4 [▼
    "id" => 9
    "position" => 3
    "jobs" => array:2 [▼
      0 => array:21 [▼
        "id" => 2
        "name" => "9987C"
        "plan_id" => null
      ]
      1 => array:21 [▼
        "id" => 3
        "name" => "1009V"
        "plan_id" => null
      ]
    ]
  ]
  1 => array:4 [▼
    "id" => 8
    "position" => 2
    "jobs" => array:1 [▼
      0 => array:21 [▼
        "id" => 2
        "name" => "10bb"
        "plan_id" => null
      ]
      1 => array:21 [▼
        "id" => 4
        "name" => "CC09"
        "plan_id" => null
      ]
    ]
  ]
  ...

i need to group same nested array from jobs with the same id like:

array:4 [▼
   8 => array:4 [▼
     "id" => 8
     "position" => 2
   ]
    "id" => 9
    "position" => 3
    "jobs" => array:3 [▼
      0 => array:21 [▼
        "id" => 2
        "name" => "01"
        "plan_id" => null
      ]
      1 => array:21 [▼
        "id" => 3
        "name" => "09BB"
        "plan_id" => null
      ]
      3 => array:21 [▼
        "id" => 4
        "name" => "10CB"
        "plan_id" => null
      ]
    ]
  ]

i have problem checking the same jobs id inside the foreach:

$finalJobs = array();

       foreach ($CompleteJobs as $index => $jobs) {
            foreach ($jobs['jobs'] as $job) {

                if (!empty($finalJobs)) {
                    foreach ($finalJobs as &$finalJob) {
                        foreach ($finalJob['jobs'] as $Fjob) {
                           if (!empty(array_intersect($Fjob, $job))) {
                             //here is my problem
                            }
                        }
                    }
                } else {
                    $finalJobs[$job['id']] = $job;
                }

            }
        }

any help ?

Sep
03
2 months ago
Activity icon

Replied to Filter Duplicated Array Collections

wont work directly with unique since its a nested array collection

Activity icon

Started a new Conversation Filter Duplicated Array Collections

I have an collection like this:

Collection {#560 ▼
  #items: array:3 [▼
    429 => array:3 [▼
      0 => array:5 [▼
        "id" => 1242
        "post_id" => 2040
        "post" => array:21 [▶]
      ]
      1 => array:5 [▼
        "id" => 1245
        "post_id" => 2047
        "post" => array:21 [▶]
      ]
    ]
    430 => array:3 [▼
      0 => array:5 [▼
        "id" => 1243
        "post_id" => 2040
        "post" => array:21 [▶]
      ]
    431 => array:3 [▼
      0 => array:5 [▼
        "id" => 1245
        "post_id" => 2041
        "post" => array:21 [▶]
      ]
      1 => array:5 [▼
        "id" => 1244
        "post_id" => 2047
        "post" => array:21 [▶]
      ]
    ]
  ]
}

if the post_idlike 2040 and 2047 from array 429 is found in the other array 431 then return only the only array 431 so i would have the duplicated removed

Aug
14
2 months ago
Activity icon

Replied to Unit Test Relations

Yes i need to check the relation between them HasOne or BelongsTo etc @tykus ?

Activity icon

Replied to Unit Test Relations

@tykus i have this relations Users with Plan, Plan with Plan Assignment, Plan with Region, Region with program

It better do insert the relations in the factory, or do the test manually check the relations column ids? Or What do you recommend for unit tests ?

Activity icon

Started a new Conversation Unit Test Relations

I have complex relations, witch is the best way to test relations ? Any best practice examples ?

Aug
01
3 months ago
Activity icon

Replied to Validation Exception

@tykus thanks for the idea, the failedValidation should i override in a new handler or?

Activity icon

Replied to Validation Exception

@tykus i would like to continue the methode and store the changes with the warning showed in front end as warning popup(send from backend like json error message), with the rest of the errors stop and catch the exception.

Activity icon

Started a new Conversation Validation Exception

I need to allow some validation error to be displayed as warning not like error, how can i do that? With custom validation exception or?

I have a custom Request with custom Rule, i need to allow only one case as warning and display it as warning not really like error, the rest of the cases i need to display then like its now like real error.

Jul
23
3 months ago
Activity icon

Started a new Conversation Filter Model Entry Laravel Collection

I need to go though each entry where some condition it meet.

I have all conditions in an extra array, the array can have more or few keys:

 array:2 [
  "date" => "true"
  "column" => 1
....
]

I would need to filter all Model entry's where implementation_date is not null and column is 1

$allUsers = Users::all();
        foreach ( array_keys($arrayColumns) as $key ) {
            if ($key === 'column' || $key === 'Two' || $key === 'Three') {
        $allUsers->where($key, 1)
        }
            if ($key === 'date' || $key === 'dateTwo' ) {
        $allUsers->where($key, '!=',null)
        }
    }

$allUsers->all();

I would like to habe something like the above but its not really working the where