Go3shom's avatar

Go3shom wrote a comment+100 XP

3w ago

@RogerManich Yes, I noticed this after a while. Thanks Roger

Go3shom's avatar

Go3shom liked a comment+100 XP

1mo ago

@Go3shom when fetching ideas in when() condition make sure the first argument point on the $status var, instead of $request->status:

$ideas = $user ->ideas() ->when($status, fn($query, $status) => $query->where('status', $status)) ->get();

Go3shom's avatar

Go3shom wrote a comment+100 XP

1mo ago

@skeith22 Wow, you are absolutely right. The second scenario you're passing null so it didn't affect the filtering! ^_^

Thaks a lot

Go3shom's avatar

Go3shom wrote a comment+100 XP

1mo ago

@radmax I was facing an issue too but the error was

 FAILED  Tests\Browser\CreatIdeaTest > it creates a new idea
  Failed asserting that an array has the key 'title'.

  at tests\Browser\CreatIdeaTest.php:27
     23▕         ->click('Create')
     24▕         ->assertPathIs('/ideas')
     25▕     ;
     26▕
  ➜  27▕     expect($user->ideas()->first())->toMatchArray([
     28▕         'title' => 'Idea Title',
     29▕         ...

And I don't know why did the relation $user->ideas()->first() returns null!

But it works after trying what you've said, so, thanks a lot.

Go3shom's avatar

Go3shom wrote a comment+100 XP

1mo ago

Could anyone please tell me why I can't get all the cards in case of writing gibberish status in the query string?

if (! in_array($status, IdeaStatus::values())) {
    $status = null;
}

I wrote the same code exactly as Jeff wrote it but it returns the result of zero records (No ideas at this time.)!

Go3shom's avatar

Go3shom wrote a comment+100 XP

1mo ago

@wordxpression If I understand what you mean right, you may get the All button count by calling the count method on $statusCounts like so:

<span class="text-xs pl-3">{{ $statusCounts->count() }}</span>
Go3shom's avatar

Go3shom wrote a comment+100 XP

2mos ago

@AI-Gmz They may be satisficed with "Copy visible code from video to clipboard" button or something!