Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created March 4, 2021 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/92c1cdbe506b28ce0a17cc651fdfeb6e to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/92c1cdbe506b28ce0a17cc651fdfeb6e to your computer and use it in GitHub Desktop.
<?php
use App\Models\Country;
use Illuminate\Support\Facades\Route;
Route::get('/through', function () {
$spainPosts = Country::with(["posts:user_id,title", "posts.user:id,name,country_id"])->whereName("Spain")->first();
dd($spainPosts->posts);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment