davidifranco

davidifranco

Member Since 2 Years Ago

Experience Points
21,220
Total
Experience

3,780 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
198
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 5
21,220 XP
Jul
13
3 weeks ago
Activity icon

Replied to Dom Manipulation Of Html Content In Textarea

Its risky, but you can render the unescaped HTML content to the dom like this.

{!! $html !!}

Just note, as the docs warn: Be very careful when echoing content that is supplied by users of your application. Always use the escaped, double curly brace syntax to prevent XSS attacks when displaying user supplied data.

see here: https://laravel.com/docs/7.x/blade#displaying-data under "Unescaped Data".

Activity icon

Replied to $collection->chunk With Call Back

Glad you asked :) .

I am rendering a PDF and can only fit so many related items per page.. so, for example, if was printing orders with nested order details and can fit a max of 10 order details per page, I would want to chunk orders based on the order detail count.

While the order detail count is still less than 10 keep in the same chunk, but if it goes above 10 create a new chunk... I hope I made that clear? Open to other suggestions on how to accomplish this within a blade view.

Activity icon

Started a new Conversation $collection->chunk With Call Back

I am trying to chunk a collection based on a count of a related items.

i have loaded the relationship count but i cant seem to figure out how to break up the collection to different chunk sizes. Normally

$collection->chunk(3);

Would chunk the collection to 3 items max (the last chunk would be whatever is remaining).

Is there any way to chunk based on other criteria... something like $collection->takeWhile () but for chunking.

bobby... I know your out there! please help! :)

Jun
11
1 month ago
Activity icon

Replied to MapToDictionary And Reduce On Collection

Ended up doing this...

$data = collect([
    ['ITEM' => 'TABLE', 'QTY' => 5],
    ['ITEM' => 'CHAIR', 'QTY' => 2],
    ['ITEM' => 'DOOR', 'QTY' => 1],
    ['ITEM' => 'CHAIR', 'QTY' => 10],
    ['ITEM' => 'TABLE', 'QTY' => 20]
])->mapToDictionary(function ($item) {
    return [$item['ITEM'] => $item['QTY']];
})->map(function ($item, $key) {
    return collect($item)->sum();
})->all();
Activity icon

Replied to MapToDictionary And Reduce On Collection

Gorgeous... thank you Michal!

Activity icon

Replied to Trimming Down An Expensive Query

Perhaps instead of getting the count of records your can select the id's and query against them.

	$ids = $this->section->claddings()
			->select('id')
			->where('id', '<=', $this->id)
			->get();
       
	 // Extract widths for those records
        $SumOfWidths = $this->section->claddings()->whereIn('id', $ids)->sum('width');

        // Count previous records not including itself
        $ids = $this->section->claddings()->select('id')->whereNotIn('id', $this->id)->count();

        // Extract Results for those records
        $PreviousResults = $this->section->claddings()->whereIn('id', $ids)->sum('SequencingResults');


        // If rounding Down is selected
        if ($this->rounding == 3) {
            return floor($SumOfWidths / $this->SheetWidth - $PreviousResults);
        }
        // else round up
        else {
            return  ceil($SumOfWidths / $this->SheetWidth - $PreviousResults);
        }
Activity icon

Started a new Conversation MapToDictionary And Reduce On Collection

I have the following collection:

collect([
	['ITEM' => 'TABLE', 'QTY' => 5],
	['ITEM' => 'CHAIR', 'QTY' => 2],
	['ITEM' => 'DOOR', 'QTY' => 1],
	['ITEM' => 'CHAIR', 'QTY' => 10],
	['ITEM' => 'TABLE', 'QTY' => 20]
]);

I want to end up with

	['TABLE' => 25, 'CHAIR' => 12, 'DOOR' => 1]

What is the cleanest way to achieve this?

Mar
21
4 months ago
Activity icon

Commented on Make The Timeline Dynamic

I almost always save validated data to a $validated variable. To me I prefer to write

‘’’ Auth()->User()->tweet()->create($validated); ‘’’

Looking forward to seeing how “mentions” will be handled....

Feb
18
5 months ago
Activity icon

Commented on What I Learned About Cypress On Day 2

Next TDD series with Cypress would be cool.