Associates the model provided back to the model by way of their proper keys

@param   object   $model     The model to associate
@param   closure  $callback  A callback to potentially append additional data
@return  object
@since   2.0.0
485642
public function associate($model, $callback = null)
	{
		$relationship = $this;
		Event::listen(
			function($event) use ($model, $relationship)
			{
				$relationship->connect([$model->id]);
			},
			$model->getTableName() . '_new'
		);

		return $model;
	}
393917
public function bindCallback(Closure $callback, $query = null) {
        call_user_func_array($callback, [$this, $query]);

        return $this;
    }
299750
public function maybe(Closure $callback) {
        $predicate = new Predicate(self::MAYBE);
        $predicate->bindCallback($callback);

        $this->_params[] = $predicate;

        $this->addBinding(null, $predicate);

        return $this;
    }
485588
public function map(Closure $callback)
    {
        return new self(array_map($callback, $this->items, array_keys($this->items)));
    }
762522
public function register($name, Closure $callback)
    {
        $this->checkCallbackName($name);

        $this->callbacks[$name] = $callback;

        return $this;
    }
895549
public function filter($callback)
    {
        $filter = array_values(array_filter($this->models, $callback));
        return new ModelResult($this->model_class, $filter);
    }
353552
public function map(callable $callback)
    {
        $result = parent::map($callback);

        return $result->contains(function ($item) {
            return ! $item instanceof Model;
        }) ? $result->toBase() : $result;
    }
906038
public static function model($model, $closure = null) {  
        $model = ucwords(strtolower($model));
        $request = KernelHttp::request();
        if($request->getModel() == $model) 
            self::explorer($model, $closure, $request);        
    }
560645
public function pretend( Closure $callback ) {
		return $this->withFreshQueryLog( function () use ( $callback ) {
			$this->pretending = true;

			// Basically to make the database connection "pretend", we will just return
			// the default values for all the query methods, then we will return an
			// array of queries that were "executed" within the Closure callback.
			$callback( $this );

			$this->pretending = false;

			return $this->getLogger()->getQueryLog();
		} );
	}
1347318
public function rightJoinClosure(string $table, \Closure $callback): BaseQueryRelateContract
    {
        $this->query->rightJoin($table, $callback);

        return $this;
    }
746604
public static function instance(Closure $callback = null, $argument = [])
    {
        if (!is_null($callback) && $callback instanceof Closure) {
            return $callback(static::getInstance($argument));
        }

        return static::getInstance($argument);
    }
400456
public function map(\Closure $callback)
    {
        $result = [];
        foreach ($this->value as $entity) {
            $result[] = $callback($entity);
        }

        return $result;
    }
1089665
public static function forModel($container, $class, $callback = null)
    {
        return function ($value) use ($container, $class, $callback) {
            if (is_null($value)) {
                return;
            }

            // For model binders, we will attempt to retrieve the models using the first
            // method on the model instance. If we cannot retrieve the models we'll
            // throw a not found exception otherwise we will return the instance.
            $instance = $container->make($class);

            if ($model = $instance->resolveRouteBinding($value)) {
                return $model;
            }

            // If a callback was supplied to the method we will call that to determine
            // what we should do when the model is not found. This just gives these
            // developer a little greater flexibility to decide what will happen.
            if ($callback instanceof Closure) {
                return call_user_func($callback, $value);
            }

            throw (new ModelNotFoundException)->setModel($class);
        };
    }
1150801
private function cacheSpammers(Closure $callback)
    {
        return cache()->remember($this->cacheKey, $this->cacheExpires, $callback);
    }
1059542
public function table($table, Closure $callback)
    {
    	if(!$this->hasTable($table)) {
    		return hst_message('is has table');
    	}
        \Schema::connection($this->databaseName)->table($table, $callback);
    }
757952
public function joinClosure(string $table, \Closure $callback): BaseQueryRelateContract
    {
        $this->query->join($table, $callback);

        return $this;
    }
1151273
public static function create(Closure $callback = null)
    {
        if (self::$instance === null) {
            self::$instance = new self();
        }

        if ($callback instanceof Closure) {
            return $callback(self::$instance);
        }

        return self::$instance;
    }