<commit_before><?php

namespace Orchestra\Tenanti;

use Orchestra\Support\Fluent;
use Illuminate\Database\Eloquent\Model;

class Tenantor extends Fluent
{
    /**
     * Make a tenantor instance.
     *
     * @param  string  $name
     * @param  mixed  $key
     * @param  string|null  $connection
     * @param  \Illuminate\Database\Eloquent\Model|null  $model
     *
     * @return static
     */
    public static function make(string $name, $key, $connection = null, ?Model $model = null)
    {
        if ($key instanceof Model) {
            $model = $key;
            $key = $model->getKey();
            $connection = $connection ?? $model->getConnectionName();
        }

        return new static(compact('name', 'key', 'connection', 'model'));<commit_msg>Add Tenantor::fromEloquent()<commit_after><?php

namespace Orchestra\Tenanti;

use Orchestra\Support\Fluent;
use Illuminate\Database\Eloquent\Model;

class Tenantor extends Fluent
{
    /**
     * Make a tenantor instance.
     *
     * @param  string  $name
     * @param  \Illuminate\Database\Eloquent\Model  $model
     * @param  string|null  $connection
     *
     * @return static
     */
    public static function fromEloquent(string $name, Model $model, ?string $connection = null)
    {
        return static::make(
            $name, $model->getKey(), $connection ?? $model->getConnectionName()
        );
    }

    /**
     * Make a tenantor instance.
     *
     * @param  string  $name
     * @param  mixed  $key
     * @param  string|null  $connection
     * @param  \Illuminate\Database\Eloquent\Model|null  $model
     *
     * @return static
     */
    public static function make(string $name, $key, ?string $connection = null, ?Model $model = null)
    {
        return new static(compact('name', 'key', 'connection', 'model'));
{'fraction_non_alphanumeric': 0.1298844248761695, 'fraction_numerical': 0.0, 'mean_word_length': 2.5232558139534884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '459947', 'n_tokens_mistral': 553, 'n_tokens_neox': 562, 'n_words': 135}