A few things:
What is the point of rec_id on the user table? Can you not just use the primary id?
If not, why is the data type for rec_id a string?
Why is the join_date a string and not a date type?
In your code, you're accessing rec_id twice unnecessarily. You're assigning it to a temporary variable, then accessing it again in your query.
$user = Auth::User()->rec_id; // temporary variable
$credits = 0;
$leaves = DB::table('leaves_admin')
->where('rec_id',$user) // use temporary variable here instead
->get();
return view('Leave.leaveEmployee', compact('leaves','user','credits'));
As for the credits calculations, there are several techniques you could use. You could set up a daily (nightly) scheduled job that iterates over all the users and calculates their credits and persists it to the database (or perhaps cache the results). This might be the preferred method if your app is going to be generating a lot of on-the-fly queries.
If there is no threat of the business changing how credits are accrued, you could quite easily make an algorithm to determine the credits for a user. Something like:
$credits = Carbon\Carbon::parse($user->join_date)->startOfDay()->diffInMonths(now()) * 1.5;