Closed kikky7 closed 4 years ago
What do the Ad
model and its factory look like?
What's the result of dd($ad->getAttributes(), \DB::table('ads')->get());
Found bug, it's my mistake. I have global scope which filters them by is_preview
.
Thank you! I would never find it without posting database dump here.
Description:
Can't get model in testing with create method.
Steps To Reproduce:
This is response:
Why first created Ad can't be fetched with
Ad::first()
orAd::where('title', 'This is my first ad')->first()
? It is always null...Data is saved in database, which is confirmed with this line of code:
$this->assertDatabaseHas('ads', [ 'title' => 'This is first ad', ]);
It only happens with this model (Ad); as you can see User works as expected, same as any other custom model I tried.