avatar
How to work with cookies in JavaScript PHP
import Cookies from 'js-cookie';

export default {
  setCookie(name, val, duration) {
    if (duration) {
      Cookies.set(name, val, { expires: duration, path: '/' });
    } else {
      Cookies.set(name, val, { path: '/' });
    }
  },

  getCookie(name) {
    return Cookies.get(name) || '';
  },

  deleteCookie(name) {
    Cookies.remove(name, { path: '/' });
  },
}
24
get and set Cookie Laravel
You need to login to do this manipulation!