<?php
namespace App\Http\Controllers;
 
use App\Http\Controllers\Controller;
use App\Mail\DemoEmail;
use Illuminate\Support\Facades\Mail;
 



use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\http\Request;
use Illuminate\http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Input;
use Hash;


use DB;


class MailController extends Controller
{
    public function send()
    {

        $objDemo = new \stdClass();
        
        $objDemo->password= 'Ye ha pass';
        $objDemo->receiver = 'Name of Person';
 
        Mail::to("rabeyamazhar@gmail.com")->send(new DemoEmail($objDemo));
return response()->json(['status'=>'success']);  

    }


public function testes(Request $request)
    {
//return "heeee";

        $objDemo = new \stdClass();
        
        $objDemo->password= 'Ye ha pass';
        $objDemo->receiver = 'Name of Person';
 
        Mail::to("rabeyamazhar@gmail.com")->send(new DemoEmail($objDemo));
return response()->json(['status'=>'success']);  
    }



public function sendmesend (Request $request)
    {
   //return "hell no";
   
   if(isset($request['email']) && !empty($request['email'])) 
			{
				$email=$request['email'];
				
				
				
				$users = DB::select('select * from users where email = ?', [$email]);
					
					if($users)
					{
						return response()->json(['status'=>'success']);
					}
					else
					{
						return response()->json(['status'=>'failed','error'=>'Wrong Username']);
					}	


			}

		else 
			{
				return response()->json(['status'=>'failed','error'=>'Incomplete Parameters']);
			}
			
    }

}




