PHP code example of whilesmart / eloquent-schema-conformance

1. Go to this page and download the library: Download whilesmart/eloquent-schema-conformance library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

whilesmart / eloquent-schema-conformance example snippets


'tables' => [
    'transactions' => [
        'columns' => [
            'intent' => ['type' => 'string', 'default' => 'regular'],
            'metadata' => ['type' => 'json', 'nullable' => true],
        ],
        'indexes' => [
            ['columns' => ['intent']],
        ],
    ],
],

use Whilesmart\SchemaConformance\Testing\SchemaConformanceAssertions;

class SchemaConformanceTest extends TestCase
{
    use SchemaConformanceAssertions;

    public function test_schema(): void
    {
        $this->assertSchemaConformant();
        $this->assertAlteredColumnsDeclared(database_path('migrations'));
        $this->assertModelAttributesHaveColumns(/* your models */);
    }
}