<commit_before><?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Test;
use App\User;
use Illuminate\Http\Request;
use Intervention\Image\Facades\Image;

class TestsController extends Controller
{

    public function __construct()
    {
        $this->middleware('jwt.auth');
    }


    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $tests = Test::all();

        return response()->json([
            'data' => $tests
        ], 200);
    }

    /**<commit_msg>Change the Index method to only show the current users posts.<commit_after><?php

namespace App\Http\Controllers;

use App\Http\Requests;
use App\Test;
use App\User;
use Auth;
use Illuminate\Http\Request;
use Intervention\Image\Facades\Image;

class TestsController extends Controller
{

    public function __construct()
    {
        $this->middleware('jwt.auth');
    }


    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //$tests = Test::all();

        $id = Auth::user()->id;
        $user = User::find($id);

        $tests = $user->tests()->get();

        return response()->json([
            'data' => $tests
        ], 200);
    }

    /**
{'fraction_non_alphanumeric': 0.14108187134502925, 'fraction_numerical': 0.0043859649122807015, 'mean_word_length': 2.314769975786925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '4377035', 'n_tokens_mistral': 417, 'n_tokens_neox': 413, 'n_words': 98}