<commit_before><?php

namespace App\Listeners;

use Mail;
use App\Events\SlotChanged;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendUserShiftConfirmation
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Send a user a confimation email for taken/assigned shift
     *
     * @param  SlotChanged  $event
     * @return void
     */
    public function handle(SlotChanged $event)
    {
        if ($event->change['status'] === 'taken')
        {
            $slot = $event->slot;
            $user_email = $event->change['email'];
            $user_name = $event->change['name'];
            $event_name = $event->slot->schedule->shift->event->name;
            $shift_name = $event->slot->schedule->shift->name;
            $start_date = $event->slot->start_date;
            $start_time = $event->slot->start_date;
            $end_time = $event->slot->end_time;

            $admin_assigned = false;
            if (isset($event->change['admin_assigned']))
            {
                $admin_assigned = $event->change['admin_assigned'];
            }

            $event_data = compact('slot', 'user_email', 'user_name', 'event_name', 'shift_name', 'start_date', 'start_time', 'end_time', 'admin_assigned');

            Mail::send('emails/user-shift-confirmation', $event_data, function ($message) use ($user_email, $user_name, $shift_name)
            {
                $message->to($user_email, $user_name)->subject('Confirmation Email - ' . $shift_name . ' shift!');
            });
        }
    }
}<commit_msg>changed timestamp format of start_date, start_time, end_time for email confirmation<commit_after><?php

namespace App\Listeners;

use Mail;
use App\Events\SlotChanged;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendUserShiftConfirmation
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Send a user a confimation email for taken/assigned shift
     *
     * @param  SlotChanged  $event
     * @return void
     */
    public function handle(SlotChanged $event)
    {
        if ($event->change['status'] === 'taken')
        {
            $slot = $event->slot;
            $user_email = $event->change['email'];
            $user_name = $event->change['name'];
            $event_name = $event->slot->schedule->shift->event->name;
            $shift_name = $event->slot->schedule->shift->name;
            $start_date = date('l M d',strtotime($event->slot->start_date));
            $start_time = date('h:i a',strtotime($event->slot->start_time . $event->slot->start_date));
            $end_time = date('h:i a',strtotime($event->slot->end_time . $event->slot->start_date));

            $admin_assigned = false;
            if (isset($event->change['admin_assigned']))
            {
                $admin_assigned = $event->change['admin_assigned'];
            }

            $event_data = compact('slot', 'user_email', 'user_name', 'event_name', 'shift_name', 'start_date', 'start_time', 'end_time', 'admin_assigned');

            Mail::send('emails/user-shift-confirmation', $event_data, function ($message) use ($user_email, $user_name, $shift_name)
            {
                $message->to($user_email, $user_name)->subject('Confirmation Email - ' . $shift_name . ' shift!');
            });
        }
    }
}
{'fraction_non_alphanumeric': 0.1516520756848348, 'fraction_numerical': 0.0, 'mean_word_length': 2.3605313092979125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '3515872', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1051, 'n_words': 191}