<commit_before><?php
namespace App\Http\Controllers;

use App\Announcement;
use App\Event;
use App\Student;
use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;

class EmailController extends Controller
{
    public static function send(array $request)
    {
        foreach ($request as $elem) {
            if($elem['source_table']=='events'){
                $action_pre = '';
                $action_post = '';
                $person_name = '';

                $event = Event::find($elem['source_id']);

                $receiver = DB::table($elem['receiver_table'])->where('id', $elem['receiver_id'])->first();

                if ($elem['receiver_table'] == 'mentors')
                    $person_name = DB::table($event->responsible_first_table)->where('id', $event->responsible_first_id)->value('name');
                else if ($elem['receiver_table'] == 'students')
                    $person_name = DB::table($event->responsible_second_table)->where('id', $event->responsible_second_id)->value('name');

                switch ($elem['type']) {
                    case 'request_extra':
                        $action_post = 'is requested to you for an extra lesson on ';
                        break;
                    case 'decided_extra':
                        $action_pre = 'You have an extra lesson with ';
                        break;
                    case 'accepted_extra':
                        $action_post = 'accepted an extra lesson on ';
                        break;
                    case 'rejected_extra':
                        $action_post = 'rejected an extra lesson on ';
                        break;
                    case 'time_changed_extra':
                        $action_post = 'changed time of the extra lesson to ';
                        break;
                    case 'updated_extra':
                        $action_pre='Extra lesson has been updated by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' to ';
                        break;
                    case 'cancelled_extra':
                        $action_pre='Extra lesson has been cancelled by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' which would be held on ';
                        break;
                    case 'deleted_extra':
                        $action_pre='Extra lesson has been deleted by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' which would be held on ';
                        break;
                };

                $data = [<commit_msg>Fixed grammar mistake on email template.<commit_after><?php
namespace App\Http\Controllers;

use App\Announcement;
use App\Event;
use App\Student;
use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;

class EmailController extends Controller
{
    public static function send(array $request)
    {
        foreach ($request as $elem) {
            if($elem['source_table']=='events'){
                $action_pre = '';
                $action_post = '';
                $person_name = '';

                $event = Event::find($elem['source_id']);

                $receiver = DB::table($elem['receiver_table'])->where('id', $elem['receiver_id'])->first();

                if ($elem['receiver_table'] == 'mentors')
                    $person_name = DB::table($event->responsible_first_table)->where('id', $event->responsible_first_id)->value('name');
                else if ($elem['receiver_table'] == 'students')
                    $person_name = DB::table($event->responsible_second_table)->where('id', $event->responsible_second_id)->value('name');

                switch ($elem['type']) {
                    case 'request_extra':
                        $action_post = 'has requested to you for an extra lesson on ';
                        break;
                    case 'decided_extra':
                        $action_pre = 'You have an extra lesson with ';
                        break;
                    case 'accepted_extra':
                        $action_post = 'accepted an extra lesson on ';
                        break;
                    case 'rejected_extra':
                        $action_post = 'rejected an extra lesson on ';
                        break;
                    case 'time_changed_extra':
                        $action_post = 'changed time of the extra lesson to ';
                        break;
                    case 'updated_extra':
                        $action_pre='Extra lesson has been updated by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' to ';
                        break;
                    case 'cancelled_extra':
                        $action_pre='Extra lesson has been cancelled by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' which would be held on ';
                        break;
                    case 'deleted_extra':
                        $action_pre='Extra lesson has been deleted by ';
                        $person_name = DB::table($event->owner_table)->where('id', $event->owner_id)->value('name');
                        $action_post=' which would be held on ';
                        break;
                };

                $data = [
{'fraction_non_alphanumeric': 0.12238959260527217, 'fraction_numerical': 0.0, 'mean_word_length': 1.521795425118688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '4998294', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1394, 'n_words': 319}