?
Current File : /home/sanghavirealty/public_html/appazwer/Models/Lead.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Product;
use Mail;
use App\Mail\DefaultEmail;



class Lead extends Model
{
    use HasFactory;

    public $table="ticketlead";

    const CREATED_AT = 'createdate';
    const UPDATED_AT = 'modifydate';


    // public function getListTitle()
    // {
    //         return $this->belongsTo(Product::class, 'listing_id');
    // }


    // public function getBrandTitle()
    // {
    //         return $this->belongsTo(Brand::class, 'brandid');
    // }

    // public function getReviewTitle()
    // {
    //         return $this->belongsTo(BrandRating::class, 'reviewid');
    
    // }



 


    public function GetAmericanStyleNumber($number){

        $phone = $number;

        $ac = substr($phone, 0, 3); // 123
        $prefix = substr($phone, 3, 3); // 456
        $suffix = substr($phone, 6); // 7890
        
        $formatted = "({$ac}){$prefix}-{$suffix}";


        return $formatted ;


   }



   Public static function SendMailEmit($emailTo,$name,$subject,$message,$fromEmail,$fromName){

        $mailData = [
            'title' => $subject,
            'name'  => $name , 
            'body' => $message,
        ];

        // $fromEmail,$fromName

     


        Mail::to($emailTo)->send(new DefaultEmail($mailData,$subject,$fromEmail,$fromName));

        dd('Email send successfully.');





    }




    // protected $fillable = ['listing_id','name','email','phone','message','type','subject'];

}