app/Services/AccountServices.php
/***
     * Search by registration number
     * @param $registrationNumber
     * @return null
     */
Search by registration number
@param $registrationNumber
@return null
Search by registration number @param $registrationNumber @return null
public static function customerByAccount($registrationNumber)
    {
        if ($registrationNumber) {
            return Account::with([
                "contact",
                "subscriptions" => function ($query) {
                    $query->active()->latest();
                },
                "bills" => function ($query) {
                    $query->latest()->first();
                },
                "transactions" => function ($query) {
                    $query->latest()->first();
                },
            ])
                ->where("registration_number", $registrationNumber)
                ->get();
        }
        return null;
    }
public static function customerByAccount ( $ registrationNumber ) { if ( $ registrationNumber ) { return Account :: with ( [ " contact " , " subscriptions " => function ( $ query ) { $ query -> active ( ) -> latest ( ) ; } , " bills " => function ( $ query ) { $ query -> latest ( ) -> first ( ) ; } , " transactions " => function ( $ query ) { $ query -> latest ( ) -> first ( ) ; } , ] ) -> where ( " registration_number " , $ registrationNumber ) -> get ( ) ; } return null ; }
Search by registration number
 @param $registrationNumber
 @return null
Search by registration number @param $registrationNumber @return null