<commit_before><?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface
{
    protected $softDelete = true;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    public $hidden = array('password', 'created_at', 'updated_at', 'deleted_at', 'email');

    public $guarded = array('id', 'created_at', 'updated_at');
    protected $appends = ['counts'];

    public static $rules = array(
        'name' => 'required|min:2|max:99',
        'email' => 'required|email|max:99|unique:users,email',
        'username' => 'required|alpha_dash|max:99|unique:users,username',
        'password' => '<PASSWORD>',
        'bio' => 'sometimes|max:240'
    );

    public static $updateRules = array(
        'name' => 'sometimes|min:2|max:99',
        'email' => 'sometimes|email|max:99|unique:users,email',
        'username' => 'sometimes|alpha_num|max:99|unique:users,username',
        'password' => '<PASSWORD>',
        'bio' => 'sometimes|max:240'
    );

    public function getCountsAttribute() {
        $following = Relationship::where('user_id', '=', $this->getAuthIdentifier())->count();
        $followers = Relationship::where('follows_user_id', '=', $this->getAuthIdentifier())->count();

        return $this->attributes['counts'] = [
            'following' => $following,
            'followers' => $followers
        ];
    }

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }

    /**<commit_msg>Comments out attribute append as it caused bad performace and usage<commit_after><?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface
{
    protected $softDelete = true;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    public $hidden = array('password', 'created_at', 'updated_at', 'deleted_at', 'email');

    public $guarded = array('id', 'created_at', 'updated_at');
    //protected $appends = ['counts'];

    public static $rules = array(
        'name' => 'required|min:2|max:99',
        'email' => 'required|email|max:99|unique:users,email',
        'username' => 'required|alpha_dash|max:99|unique:users,username',
        'password' => '<PASSWORD>',
        'bio' => 'sometimes|max:240'
    );

    public static $updateRules = array(
        'name' => 'sometimes|min:2|max:99',
        'email' => 'sometimes|email|max:99|unique:users,email',
        'username' => 'sometimes|alpha_num|max:99|unique:users,username',
        'password' => '<PASSWORD>',
        'bio' => 'sometimes|max:240'
    );

    public function getCountsAttribute() {
        $following = Relationship::where('user_id', '=', $this->getAuthIdentifier())->count();
        $followers = Relationship::where('follows_user_id', '=', $this->getAuthIdentifier())->count();

        return $this->attributes['counts'] = [
            'following' => $following,
            'followers' => $followers
        ];
    }


    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }

    /**
{'fraction_non_alphanumeric': 0.1566475430281866, 'fraction_numerical': 0.009977550511349464, 'mean_word_length': 2.7060998151571165, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 45, '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': '5691563', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1188, 'n_words': 254}