PHP code example of mmx / database

1. Go to this page and download the library: Download mmx/database 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/ */

    

mmx / database example snippets


$resources = \MMX\Database\Models\Resource::query()
    ->with('Template:id,templatename')
    ->with('TvValues')
    ->where('published', true)
    ->get();
foreach ($resources as $resource) {
    print_r($resource->toArray());
}

$categories = \MMX\Database\Models\Category::query()
    ->with('Templates')
    ->with('Plugins')
    ->with('Snippets')
    ->with('Chunks')
    ->with('Tvs')
    ->get();
foreach ($categories as $category) {
    print_r($category->toArray());
}