app\models\KudosuHistory::scopeWithGiver PHP Method

scopeWithGiver() public method

public scopeWithGiver ( $query )
    public function scopeWithGiver($query)
    {
        $userTableName = (new User())->getTable();
        $thisTableName = $this->getTable();
        return $query->whereExists(function ($query) use($userTableName, $thisTableName) {
            $query->select(DB::raw(1))->from($userTableName)->whereRaw("{$userTableName}.user_id = {$thisTableName}.giver_id");
        });
    }