InteractsWithDatabase
trait InteractsWithDatabase (View source)
Methods
Assert that a given where condition exists in the database.
Assert that a given where condition does not exist in the database.
Assert the count of table entries.
Assert that the given table has no entries.
Assert the given record has been "soft deleted".
Assert the given record has not been "soft deleted".
Assert the given model does not exist in the database.
Specify the number of database queries that should occur throughout the test.
Determine if the argument is a soft deletable model.
Cast a JSON string to a database compatible type.
Get the database connection.
Get the table connection specified in the given model.
Get the table column name used for soft deletes.
Seed a given database connection.
Details
        
                    protected        $this
    assertDatabaseHas(Model>|Model|Model>|string $table, array $data = [], string|null $connection = null)
        
    
    Assert that a given where condition exists in the database.
        
                    protected        $this
    assertDatabaseMissing(Model>|Model|Model>|string $table, array $data = [], string|null $connection = null)
        
    
    Assert that a given where condition does not exist in the database.
        
                    protected        $this
    assertDatabaseCount(Model|Model>|string $table, int $count, string|null $connection = null)
        
    
    Assert the count of table entries.
        
                    protected        $this
    assertDatabaseEmpty(Model|Model>|string $table, string|null $connection = null)
        
    
    Assert that the given table has no entries.
        
                    protected        $this
    assertSoftDeleted(Model>|Model|Model>|string $table, array $data = [], string|null $connection = null, string|null $deletedAtColumn = 'deleted_at')
        
    
    Assert the given record has been "soft deleted".
        
                    protected        $this
    assertNotSoftDeleted(Model>|Model|Model>|string $table, array $data = [], string|null $connection = null, string|null $deletedAtColumn = 'deleted_at')
        
    
    Assert the given record has not been "soft deleted".
        
                    protected        $this
    assertModelExists(Model>|Model|Model>|string $model)
        
    
    Assert the given model exists in the database.
        
                    protected        $this
    assertModelMissing(Model>|Model|Model>|string $model)
        
    
    Assert the given model does not exist in the database.
        
                            $this
    expectsDatabaseQueryCount(int $expected, string|null $connection = null)
        
    
    Specify the number of database queries that should occur throughout the test.
        
                    protected        bool
    isSoftDeletableModel(mixed $model)
        
    
    Determine if the argument is a soft deletable model.
        
                            Expression
    castAsJson(array|object|string $value, string|null $connection = null)
        
    
    Cast a JSON string to a database compatible type.
        
                    protected        Connection
    getConnection(string|null $connection = null, Model|Model>|string|null $table = null)
        
    
    Get the database connection.
        
                    protected        string
    getTable(Model|Model>|string $table)
        
    
    Get the table name from the given model or string.
        
                    protected        string|null
    getTableConnection(Model|Model>|string $table)
        
    
    Get the table connection specified in the given model.
        
                    protected        string
    getDeletedAtColumn(Model|Model>|string $table, string $defaultColumnName = 'deleted_at')
        
    
    Get the table column name used for soft deletes.
        
                    protected        Model|null
    newModelFor(Model|Model>|string $table)
        
    
    Get the model entity from the given model or string.
        
                            $this
    seed(list<string>|Seeder>|string $class = 'Database\\Seeders\\DatabaseSeeder')
        
    
    Seed a given database connection.