Washington (CNN) In fewer than two years, Sen. Lindsey Graham has turned from a political rival who called Donald Trump a "jackass" and a "political car wreck" to a semi-regular golf partner of the now-President and a close ally on some of the biggest issues facing the country.

It's an evolution no one would have seen coming during spring 2015, when Trump, out of spite, read Graham's cellphone number on live television , or during the 2016 presidential primaries, when Trump labeled Graham a "nut job" and "one of the dumbest human beings I have ever seen."

But in hindsight, Graham's path is not unique. Some of Trump's fiercest Republican critics have piped down in the past year, choosing to play nice and work with the White House for the sake of big picture pragmatism.

Sen. Bob Corker, who once said Trump was setting the country on a path to World War III, has grown increasingly quiet in recent weeks. Reporters asked the Foreign Relations Committee chairman at least seven times last Wednesday about Trump's controversial tweet comparing the size of his nuclear button to that of North Korea's Kim Jong Un.

Corker dodged each time.

Just days later, the Tennessee Republican flew with Trump on Air Force One to an event in his home state, giving Corker key positioning with the commander-in-chief as he works to change the Iran nuclear deal.

Michael Steel, a Republican strategist and former spokesman for then-House Speaker John Boehner, said the recent passage of the tax reform bill is drilling home the idea of what can happen when a Republican-led Congress and a Republican White House work together. And members of Congress want to be able to tell constituents they had a hand in affecting policy, even if it requires close calculation.

"I think that each elected Republican has to make a series of decisions, day in and day out, about whether they find the President's conduct acceptable and to what extent it's appropriate to work with him as opposed to sit on the back bench," said Steel, who also worked on Jeb Bush's 2016 presidential campaign.

As for Graham, Steel said the South Carolina senator has found his strategy:

"It's pretty clear he's decided that you catch more flies with honey."

Graham and Trump: A bitter history

It's no secret that Graham and Trump threw verbal bombs at each other during the Republican presidential primaries.

"You know how you make America great again? Tell Donald Trump to go to hell," Graham said on CNN's "New Day" in December 2015 , responding to Trump's statement at the time calling for the US to ban all Muslims from entering the country.

JUST WATCHED Graham: Trump's support is 'minority of GOP' Replay More Videos ... MUST WATCH Graham: Trump's support is 'minority of GOP' 02:25

A month later, Graham described Trump as the "most unprepared person" to run for president and someone who "scares the hell out of me." When asked to choose between Trump and Sen. Ted Cruz for the nomination, Graham said that was like deciding between "being shot or poisoned."

Trump, for his part, labeled Graham a "nut job" and a "disgrace," and he constantly taunted the senator, who barely registered in the polls, for his poor performance on the campaign trail. Graham dropped out of the GOP race before the primaries began and lent his support to Bush.

"Sen. Lindsey Graham embarrassed himself with his failed run for President and now further embarrasses himself with endorsement of Bush," Trump tweeted in January 2016. A month later, he tweeted that Graham was a "dumb mouthpiece" for the former Florida governor.

What a difference time can make.

Since Trump became president, he has golfed with Graham three times, more than he has with any other senator. And Graham has lauded not only Trump's golf game but also his golf course, calling Trump's property in West Palm Beach, Florida, "spectacular" last month

At the same time, Trump repeatedly endorsed the Graham-Cassidy health care effort last fall . The bill failed to go anywhere in the Senate, but Graham is still hopeful Congress will address it this year.

Now Trump and Graham are working closely together on an immigration reform proposal, an issue the senator has been passionate about for over a decade. "I've never been more optimistic," Graham told the President last week before cameras at a meeting on immigration.

Why the change in relations? Graham has said he feels a sense of obligation to work with the President. To get a seat at the table, he's learned to play to the President's deal-making sensibilities.

"Keep talking to him. Keep him close," Graham said last fall when a Washington Post reporter asked how he negotiates with Trump.

Kevin Bishop, a senior aide to Graham, argued that just because the senator may disagree with the President's style and rhetoric that doesn't translate into opposition of all things Trump. Bishop noted that both men support popular GOP agenda items like getting rid of Obamacare, supporting tax cuts, reducing regulations and placing conservatives on the Supreme Court.

"Is (Graham) going to vote against things he supports because Trump also supports them? That's utterly ridiculous," Bishop said.

A circle of rivals

But all have largely held their fire now that Trump is in the White House. Their moves to make amends with the President reflect a calculation among many Senate Republicans: While they may complain about what they view as his erratic behavior, they will look past previous disputes to get on his good side and influence him on key decisions.

Paul was at times a thorn in the President's side last year — most noticeably in September, when Paul was poised to derail one of the many Obamacare repeal efforts — but the two seem to have struck some harmony. They golfed twice last year, and Trump signed an Obamacare-related executive order in October that was inspired by an issue Paul had been pushing for months.

Rubio has worked closely with the President's daughter Ivanka Trump on tax reform provisions. Cruz has been a reliable vote for Trump and has maintained a strict policy of not commenting on the President's controversial tweets. He also worked with the White House on a health care-related amendment last summer, though the amendment ultimately wasn't taken up.

For his part, Corker has repaired his relationship with Trump after the two men exchanged fierce words in the fall, according to sources familiar with their discussions.

The two have spoken several times since late last year, particularly as Corker was weighing whether to support the sweeping tax overhaul. Ultimately, Corker reversed his position and backed the tax bill -- and endured sharp criticism over what he said was erroneous reporting suggesting he backed the bill because of a provision that would enrich him financially. Corker complained about the news coverage to Trump, who deemed it "fake news," the sources said.

BFF's with limits

While Graham has heaped unexpected praise on Trump at times, he's still approaching the mercurial President with caution and realizes there are limits to the kill-him-with-kindness approach.

"If he doesn't call himself a genius, nobody else will," Graham said to laughs on ABC's "The View."

The artful response allowed Graham to defuse a sensitive question with humor and avoid being forced to weigh in on Trump's state of mind.

He used a similar approach last week at that immigration meeting. Trump introduced Graham as someone who "used to be a great enemy of mine. Now he's a great friend of mine. I really like Lindsey, can you believe it? I never thought I'd say that but I do like him a lot."

Trump may have expected, or hoped, Graham would return the goodwill and heap similar praise on him.

"I like me, too," Graham responded, earning nervous laughter in the room.

But Graham then turned to Trump and heralded him as the one president in recent times whose tough stance on immigration makes him the perfect person to cut a deal on the stalled issue.

"Obama couldn't do it. Bush couldn't do it. I think you can do it," Graham told Trump and the assembled press.

Graham's decision to get closer to Trump is coming at a personal cost, too, as some Republicans are not happy with him. That includes people close to Sen. John McCain of Arizona, Graham's closest friend in the Senate and one of the few remaining steadfast GOP critics of Trump.

"I've known Lindsey Graham for many years and sat in the first meeting between him and John McCain. Couldn't be sadder today," tweeted John Weaver, a former top aide to McCain, shortly after the immigration meeting. "I don't believe Lindsey is being political or currying favor, just is very wrong."