403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.217
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/linkabili/app/Console/Commands/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/linkabili/app/Console/Commands/SendEmailsResponseChat.php
<?php

namespace App\Console\Commands;

use App\ChMessage;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use App\User;

class SendEmailsResponseChat extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $seconddifference = 300;
    protected $signature = 'linkabili:SendEmailsResponseChat';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = "Command che invia l\' email a professionista se un cargivere scrive e non lo legge entro 5 minuti";

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $check_email = DB::table('ch_messages as mess')
            ->selectRaw('mess.*')
            ->where('seen', 0)
            ->where('email_send', 0)
            ->join('users as u', function ($join) {
                $join->on('u.id', 'mess.from_id');
                $join->where('u.user_type', 'care_giver');
            })
            ->get();

        foreach ($check_email as $message) {
            $ch_message = ChMessage::find($message->id);
            $this->info(PHP_EOL . "Check 5 minutes " . $message->id);

            $now = Carbon::now();
            $messasge = Carbon::parse($message->created_at);
            if ($now->diffInSeconds($messasge) < $this->seconddifference)
                continue;

           $ch_message->email_send=1;
            $ch_message->save();
            $professionista = User::find($ch_message->to_id);
            $sender = User::find($ch_message->from_id);
            Mail::send('emails.professionist_not_response', ['userData' => $professionista,'sender'=>$sender], function ($message) use ($professionista) {
                $message->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'));
                $message->to($professionista->email, $professionista->name);
                $message->subject('Hai ricevuto un messaggio su Linkabili');
            });
            //FINITO
            $this->info(PHP_EOL . "Email inviata " . $message->id);

        }

        print PHP_EOL . "finisch check  " . PHP_EOL;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit