无法设置cookie

Even though there is no error returned, the following logic does not set any cookie.

<?php
namespace App\Libraries;

use Cookie;
use Location;
use Illuminate\Http\Request;

class GeoLocation
{
    public $request;
    public function __construct(Request $request)
    {
        $this->request = $request;
    }

    public function getLocationByIP()
    {
        $location = Location::get();
        // Get the location by city
        return $location->cityName;
    }

    public function getLocation()
    {
        // Check if the location is already set in the cookie
        if ($this->request->cookie('location')) {
            return $this->request->cookie('location');
        } else {
            $location = $this->getLocationByIP();
            // Set location in the cookie
            Cookie::queue('location', $location, 1440);
            return $location;
        }
    }
}