app/Services/ContactServices.php
/***
     * Returns the contact based on phone number
     * @param $phoneNumber
     * @return mixed
     */
Returns the contact based on phone number
@param $phoneNumber
@return mixed
Returns the contact based on phone number @param $phoneNumber @return mixed
public static function customerByPhone($phoneNumber)
    {
        if ($phoneNumber) {
            return Contact::with([
                "account.subscriptions" => function ($query) {
                    $query->active()->latest();
                },
                "account.bills" => function ($query) {
                    $query->latest();
                },
            ])
                ->customer()
                ->where("phone", $phoneNumber)
                ->get();
        }
        return null;
    }
public static function customerByPhone ( $ phoneNumber ) { if ( $ phoneNumber ) { return Contact :: with ( [ " account.subscriptions " => function ( $ query ) { $ query -> active ( ) -> latest ( ) ; } , " account.bills " => function ( $ query ) { $ query -> latest ( ) ; } , ] ) -> customer ( ) -> where ( " phone " , $ phoneNumber ) -> get ( ) ; } return null ; }
Returns the contact based on phone number
 @param $phoneNumber
 @return mixed
Returns the contact based on phone number @param $phoneNumber @return mixed