<commit_before><?php

class NotificationsController extends \BaseController {

	/**
	 * Display a listing of the resource.
	 * GET /notifications
	 *
	 * @return Response
	 */
	public function index()
	{
	    $notifications = Notification::where('user_id', '=', Auth::user()->id)->get(['_id', 'short_text', 'data']);
        Event::fire('notification.index', Auth::user()->id);

        return View::make('notifications.index')
            ->with('title', 'Notifications')
            ->with('notifications', $notifications->toJSON());

	}

	/**
	 * Display the specified resource.
	 * GET /notifications/{id}
	 *
	 * @param  string $id
	 * @return Response
	 */
	public function show($id)
	{
		$notification = Notification::where('_id', '=', (string)$id)->where('user_id','=', Auth::user()->id)->firstOrFail();
        return View::make('notifications.show')
            ->with('title', $notification->short_text)
            ->with('notifications', $notification->toJSON());
	}


	/**
	 * Remove the specified resource from storage.
	 * DELETE /notifications/{id}
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
        $notification = Notification::where('_id', '=', $id)->where('user_id','=', Auth::user()->id)->firstOrFail();
        $notification->viewed = 1;
        $notification->save();
	}

}<commit_msg>Changes code to set notification as viewed<commit_after><?php

class NotificationsController extends \BaseController {

	/**
	 * Display a listing of the resource.
	 * GET /notifications
	 *
	 * @return Response
	 */
	public function index()
	{
	    $notifications = Notification::where('user_id', '=', Auth::user()->id)->get(['_id', 'short_text', 'data']);
        Event::fire('notification.index', Auth::user()->id);

        return View::make('notifications.index')
            ->with('title', 'Notifications')
            ->with('notifications', $notifications->toJSON());

	}

	/**
	 * Display the specified resource.
	 * GET /notifications/{id}
	 *
	 * @param  string $id
	 * @return Response
	 */
	public function show($id)
	{
		$notification = Notification::where('_id', '=', (string)$id)->where('user_id','=', Auth::user()->id)->firstOrFail();
        //$notification->viewed = true;
        $update = Notification::find($id)->update(['viewed' => true]);
        //dd($notification->toArray());

        //$notification->save();

        /*
        //Notification::where('_id', '=', (string)$id)->where('user_id','=', Auth::user()->id)->update(['viewed' => true]);
        $wheres = ['user_id' => ['$in' => [Auth::user()->id]], '_id' => ['$in' => [$id]]];
        $changeTo = ['$set' => ['viewed' => true]];
        $options = ['multi' => false];
        $sailrDB = \DB::connection('mongodb');
        $notificationsCollection = $sailrDB->selectCollection('notifications');

        $notificationsCollection->update($wheres, $changeTo, $options);
*/
        //Notification::findOrFail($id)->update()
       // $notification->viewed = 1;
        //$notification->save();

        return View::make('notifications.show')
            ->with('title', $notification->short_text)
            ->with('notifications', $notification->toJSON());
	}


	/**
	 * Remove the specified resource from storage.
	 * DELETE /notifications/{id}
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
        $notification = Notification::where('_id', '=', $id)->where('user_id','=', Auth::user()->id)->firstOrFail();
        $notification->viewed = 1;
        $notification->save();
	}

}
{'fraction_non_alphanumeric': 0.2075365579302587, 'fraction_numerical': 0.000843644544431946, 'mean_word_length': 3.270108043217287, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '975314', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1026, 'n_words': 198}