They are all queries to your database... Do you have index on "city", "user_id" ?
You can have small gain with $user = Auth::user() and then use only $user in order to not use the method on Auth model each time.
You can also remove an if check, as you do the same twice. But here it's very small gain too.
public function index()
{
if(Auth::check()){
$user = Auth::user();
if ($user->language_id == 1) {
$language = 'en';
} elseif ($user->language_id == 2) {
$language = 'de';
} else {
$language = 'en';
}
Carbon\Carbon::setLocale($language);
$friends = Friend::where('city', $user->city)->limit(4)->get();
$statuses1 = Status::where('user_id', $user->id)->limit(8)->get();
}else{
$partners = Friend::limit(3)->get();
$statuses2 = Status::where('city', '=', '1')->limit(8)->get();
}
$friends1 = Friend::inRandomOrder()->limit(4)->get();
$friendscity = Friend::inRandomOrder()->where('city', '=', '1')->limit(4)->get();
$friends2 = Friend::limit(6)->get();
$statuses = Status::limit(4)->get();
return view('home', compact('friends','statuses1', 'partners', 'statuses2', 'friends1', 'friendscity', 'friends2', 'statuses'));
}
Are you sure that loading time is due to your backend, and not image or something else ? You can open the console of your browser to see what take time (and use Debugbar if you want to see which part take time in your backend).