PHP code example of rsanchez / deep

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

    

rsanchez / deep example snippets


Entry::dynamicParameters(array('limit', 'search:your_field_name'), $_REQUEST)->get();

Entry::whereFieldBetween('your_custom_field', array(1, 10))->get();

Entry::orWhereFieldBetween('your_custom_field', array(1, 10))->get();

Entry::whereFieldNotBetween('your_custom_field', array(1, 10))->get();

Entry::orWhereFieldNotBetween('your_custom_field', array(1, 10))->get();

Entry::whereHas('categories', function ($query) {
    // category starts with A
    $query->where('cat_name', 'LIKE', 'A%');
})->get();

$entry->entry_date
$entry->edit_date
$entry->expiration_date
$entry->comment_expiration_date
$entry->recent_comment_date

foreach ($entry->categories as $category) {
    echo '<li><a href="/blog/category/'.$category->cat_url_title.'">'.$category->cat_name.'</a></li>';
}

$number_of_rows = $entry->your_matrix_field->count();

foreach ($entry->your_matrix_field as $row) {
    echo $row->your_text_column;
    foreach ($row->your_playa_column as $childEntry) {
        echo $childEntry->title;
    }
}

$number_of_rows = $entry->your_playa_field->count();

foreach ($entry->your_playa_field as $childEntry) {
    echo $childEntry->title;
}

foreach ($entry->your_assets_field as $file) {
    $file->url
    $file->server_path
    $file->file_id
    $file->folder_id
    $file->source_type
    $file->source_id
    $file->filedir_id
    $file->file_name
    $file->title
    $file->date
    $file->alt_text
    $file->caption
    $file->author
    $file->desc
    $file->location
    $file->keywords
    $file->date_modified
    $file->kind
    $file->width
    $file->height
    $file->size
    $file->search_keywords
}

echo '<img src="'.$entry->your_file_field->url.'" />';

foreach ($entry->your_multiselect_field as $value) {
    echo $value;
}



use rsanchez\Deep\Plugin\BasePlugin;

class My_plugin extends BasePlugin
{
    public function entries()
    {
        return $this->parseEntries();
    }

    public function entries_that_start_with()
    {
        $letter = ee()->TMPL->fetch_param('letter');

        return $this->parseEntries(function ($query) use ($letter) {
            // do additional custom querying here
            $query->where('title', 'LIKE', $letter.'%');
        });
    }
}



use rsanchez\Deep\Plugin\BasePlugin;

class My_plugin extends BasePlugin
{
    public function categories()
    {
        return $this->parseCategories();
    }

    public function offices()
    {
        $country = ee()->TMPL->fetch_param('country', 'us');

        ee()->TMPL->tagparams['style'] = 'linear';

        return $this->parseCategories(function ($query) use ($country) {
            return $query->channel('offices')->where('categories.cat_name', $country);
        });
    }