<commit_before><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Rosterevent;
use Auth;
use Response;
use Log;
use DB;

class PagesController extends Controller
{
	public function home()
	{
		return view('welcome');
	}
    public function login()
    {
    	return view('pages.login');
    }

    public function profile()
    {
    	return view('users.profile');
    }

    public function myevents()
    {
        return view('users.events.myevents');
    }
    public function password()
    {
        return view('users.password');
    }

    public function getUserEvents()
    {
        if(Auth::check())
        {
            return response()->json(['events' => Auth::user()->events()->with('Attachments')->with('Links')->get()]);
        }
        else 
            return Response::json(array('events'=>''));
    }

    public function downloadfile($file)
    {
       $file= public_path(). $file;
       return Response::download($file);
    }

    public function rosterevents()
    {
        $events = DB::table('events')
            ->join('users', 'user_id', '=', 'events.user_id')
            ->select('events.id','events.title','events.startdate as start','events.enddate as end','events.color','events.textColor','users.name as name')
            ->get();

        return response()->json($events);
    }

    public function searchevents($searchterm,$myevents)
    {

        if($myevents == true)
        {
            if(!Auth::check())
            {
                return Response::json(array('message' => 'You must be logged in to search for your events!','type'=>'error' ));<commit_msg>resolving a bug where the my events in the search page were not being displayed<commit_after><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Rosterevent;
use Auth;
use Response;
use Log;
use DB;

class PagesController extends Controller
{
	public function home()
	{
		return view('welcome');
	}
    public function login()
    {
    	return view('pages.login');
    }

    public function profile()
    {
    	return view('users.profile');
    }

    public function myevents()
    {
        return view('users.events.myevents');
    }
    public function password()
    {
        return view('users.password');
    }

    public function getUserEvents()
    {
        if(Auth::check())
        {
            return response()->json(['events' => Auth::user()->events()->with('Attachments')->with('Links')->get()]);
        }
        else 
            return Response::json(array('events'=>''));
    }

    public function downloadfile($file)
    {
       $file= public_path(). $file;
       return Response::download($file);
    }

    public function rosterevents()
    {
        $events = DB::table('events')
            ->join('users', 'user_id', '=', 'events.user_id')
            ->select('events.id','events.title','events.startdate as start','events.enddate as end','events.color','events.textColor','users.name as name')
            ->get();

        return response()->json($events);
    }

    public function searchevents($searchterm,$myevents)
    {

        if($myevents == 'true')
        {
            if(!Auth::check())
            {
                return Response::json(array('message' => 'You must be logged in to search for your events!','type'=>'error' ));
{'fraction_non_alphanumeric': 0.1558891454965358, 'fraction_numerical': 0.0, 'mean_word_length': 2.5906735751295336, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5311653', 'n_tokens_mistral': 995, 'n_tokens_neox': 980, 'n_words': 218}