__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
namespace ElementorPro\Core\Database;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Model_Query_Builder extends Query_Builder {
	/**
	 * The Query Builder associated model.
	 *
	 * @var string
	 */
	public $model;

	/**
	 * Whether the returned value should be hydrated into a model.
	 *
	 * @var bool
	 */
	public $return_as_model = true;

	/**
	 * Model_Query_Builder constructor.
	 *
	 * @param string $model_classname - Model to use inside the builder.
	 * @param \wpdb|null $connection - MySQL connection.
	 */
	public function __construct( $model_classname, ?\wpdb $connection = null ) {
		$this->set_model( $model_classname );

		parent::__construct( $connection );
	}

	/**
	 * Set the model the generated from the query builder.
	 *
	 * @param $model_classname
	 *
	 * @return $this
	 */
	public function set_model( $model_classname ) {
		$this->model = $model_classname;

		return $this;
	}

	/**
	 * Disable model hydration.
	 *
	 * @return $this
	 */
	public function disable_model_initiation() {
		$this->return_as_model = false;

		return $this;
	}

	/**
	 * Disable hydration before calling the original count.
	 *
	 * @param string $column
	 *
	 * @return int
	 */
	public function count( $column = '*' ) {
		$this->disable_model_initiation();

		return parent::count( $column );
	}

	/**
	 * Disable hydration before calling the original pluck.
	 *
	 * @inheritDoc
	 */
	public function pluck( $column = null ) {
		$this->disable_model_initiation();

		return parent::pluck( $column );
	}

	/**
	 * Override the parent `get()` and make Models from the results.
	 *
	 * @return \ElementorPro\Core\Utils\Collection
	 */
	public function get() {
		$items = parent::get();

		if ( ! $this->return_as_model ) {
			return $items;
		}

		// Convert the SQL results to Model instances.
		return $items->map( function ( $comment ) {
			return new $this->model( $comment );
		} );
	}
}

Filemanager

Name Type Size Permission Actions
base-database-updater.php File 3.13 KB 0664
base-migration.php File 4.44 KB 0664
join-clause.php File 1.61 KB 0664
model-base.php File 3.48 KB 0664
model-query-builder.php File 1.89 KB 0664
query-builder.php File 30.04 KB 0664
Filemanager