1 month ago

Laravel Factory creating model but when Database is queried it's not there

Posted 1 month ago by tobyreed


In my tests I am using a factory for my "process" but the issue is when I am running my test it does not throw any errors and when I dd the model that is created it returns all of the data for the model:

App\Models\Process^ {#5657} 
data here...

However, when I try to query the database using a simple Process::all() to see if it's there, and this returns this:

Illuminate\Database\Eloquent\Collection^ {#5974
  #items: []

I think it could be due to namespacing but it all seems to be correct. Any help is appreciated!

Please sign in or create an account to participate in this conversation.