germanraffo

germanraffo

Member Since 3 Months Ago

Experience Points 90
Experience Level 1

4,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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

16 Feb
3 months ago

germanraffo left a reply on Render Two Tables In One Loop

@TRAY2 - Thanks, Tray2! I'll try :)

germanraffo left a reply on Render Two Tables In One Loop

I have one extra question:

I've made this UNION:

$first = DB::table('galleries');

      $posts = DB::table('videos')
                  ->union($first)
                  ->orderBy('published_at', 'DESC')
                  ->whereNotNull('published_at')
                  ->where('published_at', '<=', Carbon::now())
                  ->get();

Then i compact() the view with $posts variable and i can access to both tables. BUT i cant access to the relations.

I mean: I have a Gallery that hasMany Photos, so: $gallery->photos give me the relation; but with the union i cant pass $post->photos because that relation doesnt exist. How can i make the relations work with the union of $galleries and $videos as $posts?

germanraffo left a reply on Render Two Tables In One Loop

@TRAY2 - That worked! I've changed only 1 column name and everything matched and i can get an array with both tables. All i have to do know is add another column called "post_type" that tell me if the post is a gallerie or a video and fetch it with a @if inside the @foreach. Thanks, Tray2!!

germanraffo left a reply on Render Two Tables In One Loop

@TRAY2 - Hi, Tray2;

thanks for your answer! My problem is that i don't have the same fields from both tables; but i can make a few changes to make them match. I would come back in a few hours and tell you if its done!

germanraffo started a new conversation Render Two Tables In One Loop

Hi friends! Im developing my first Laravel app. Im making a simple CMS with two type of content: galleries and videos.

Im trying to make a home page that render all the galleries and videos in a grid, ordered by publish date. Galleries and Videos don't have relation between them, but i want to render them in the same loop.

public function show()
    {
      $videos = Video::published()->get();
      $galleries = Gallery::published()->get();
      return view('welcome', compact('videos', 'galleries'));
    }

This is my [email protected] ; the published() function is a scope that fetch all content by date.

I know how to send videos and galleries data to the view, but i dont know how to render them in the same loop and make something like: "if is gallery render like this ; and if is video render like that", all sorted by publish date.

Thanks a lot! And excuse me for my bad english, im from Argentina. Best regards!