<commit_before><?php

class ScheduleController extends BaseController
{
    /**
     * Get all of the schedules for the logged in user.
     * @return mixed
     */
    public function getAll()
    {
        $schedules = Schedule::where('user_id', '=', Auth::user()->id)->get();
        return Response::json($schedules);
    }

    /**
     * Create the schedule for a user.  The schedule needs to have a date associated with it,
     * so validate the POST data.  Set the user_id to the logged in user.
     * @return mixed
     */
    public function postCreate()
    {
        $input = Input::all();
        $rules = array(
            'date'  => 'required|date',
        );
        $validator = Validator::make($input, $rules);
        if ($validator->passes()) {
            $schedule = new Schedule(Input::all());
            $schedule->user_id = Auth::user()->id;
            if ($schedule->save()) {
                return Redirect::to('schedules/view/' . $schedule->id)
                    ->with('success', 'New schedule create.');
            }
        }
        return Redirect::to('schedules/new')->withErrors($validator);
    }

    /**
     * Get the schedule resource from the DB along with it's relations.  Flash the
     * data to the view.
     * @return mixed
     */
    public function getView()
    {
        // todo :: do we want anyone to be able to view someones schedule or just the user??
        $date = date('m-d-Y', Input::get('start'));
        $calendarFormat = date('Y-m-d', Input::get('start')) . "T";
        $schedule = Schedule::where('user_id', '=', Auth::user()->id)
            ->where('date', '=', $date)->with('classes', 'activities', 'sports')
            ->firstOrFail();
        // modify the data to make it displayable with the plugin
        $events = array();
        // add activities
        foreach ($schedule->activities as $activity) {
            array_push($events, array(
                'title' => $activity->name,
                'start' => $calendarFormat . $activity->start,
                'end'   => $calendarFormat . $activity->end,
                'allDay' => false,
            ));
        }
        // add classes
        foreach ($schedule->classes as $class) {
            array_push($events, array(
                'title' => $class->title,
                'start' => $calendarFormat . $class->start,
                'end'   => $calendarFormat . $class->end,
                'allDay' => false,
            ));
        }
        // add sports
        foreach ($schedule->sports as $sport) {
            array_push($events, array(
                'title' => $sport->name,
                'start' => $calendarFormat . $sport->start,
                'end'   => $calendarFormat . $sport->end,
                'allDay' => false,<commit_msg>include the schedule id<commit_after><?php

class ScheduleController extends BaseController
{
    /**
     * Get all of the schedules for the logged in user.
     * @return mixed
     */
    public function getAll()
    {
        $schedules = Schedule::where('user_id', '=', Auth::user()->id)->get();
        return Response::json($schedules);
    }

    /**
     * Create the schedule for a user.  The schedule needs to have a date associated with it,
     * so validate the POST data.  Set the user_id to the logged in user.
     * @return mixed
     */
    public function postCreate()
    {
        $input = Input::all();
        $rules = array(
            'date'  => 'required|date',
        );
        $validator = Validator::make($input, $rules);
        if ($validator->passes()) {
            $schedule = new Schedule(Input::all());
            $schedule->user_id = Auth::user()->id;
            if ($schedule->save()) {
                return Redirect::to('schedules/view/' . $schedule->id)
                    ->with('success', 'New schedule create.');
            }
        }
        return Redirect::to('schedules/new')->withErrors($validator);
    }

    /**
     * Get the schedule resource from the DB along with it's relations.  Flash the
     * data to the view.
     * @return mixed
     */
    public function getView()
    {
        // todo :: do we want anyone to be able to view someones schedule or just the user??
        $date = date('m-d-Y', Input::get('start'));
        $calendarFormat = date('Y-m-d', Input::get('start')) . "T";
        $schedule = Schedule::where('user_id', '=', Auth::user()->id)
            ->where('date', '=', $date)->with('classes', 'activities', 'sports')
            ->firstOrFail();
        // modify the data to make it displayable with the plugin
        $events = array(array('schedule' => $schedule->id));
        // add activities
        foreach ($schedule->activities as $activity) {
            array_push($events, array(
                'title' => $activity->name,
                'start' => $calendarFormat . $activity->start,
                'end'   => $calendarFormat . $activity->end,
                'allDay' => false,
            ));
        }
        // add classes
        foreach ($schedule->classes as $class) {
            array_push($events, array(
                'title' => $class->title,
                'start' => $calendarFormat . $class->start,
                'end'   => $calendarFormat . $class->end,
                'allDay' => false,
            ));
        }
        // add sports
        foreach ($schedule->sports as $sport) {
            array_push($events, array(
                'title' => $sport->name,
                'start' => $calendarFormat . $sport->start,
                'end'   => $calendarFormat . $sport->end,
                'allDay' => false,
{'fraction_non_alphanumeric': 0.1525813295615276, 'fraction_numerical': 0.0, 'mean_word_length': 1.7991093518060366, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '1066971', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1527, 'n_words': 413}