Laravel Collection Custom Grouping with Closure

3 years ago

ihsanberahim

Code

$user = User::find(234);
// $card = $user->cards()->first();

// dispatch(
//   new \App\Jobs\PushNewCardToNetwork($user, $card)
// )->delay(3);

dispatch(
  	new \App\Jobs\SendUserContactsViaEmail($user, '[email protected]')
  )->delay(3);

Output

=> Illuminate\Support\Collection {#1262
     all: [
       0 => Illuminate\Support\Collection {#1264
         all: [
           [
             "id" => 1,
             "ownerId" => 1,
             "type" => "one",
           ],
         ],
       },
       "ownerId" => Illuminate\Support\Collection {#1263
         all: [
           [
             "id" => 2,
             "ownerId" => 1,
             "type" => "two",
           ],
           [
             "id" => 3,
             "ownerId" => 1,
             "type" => "two",
           ],
         ],
       },
     ],
   }
HELO: Local email testing for your desktop!