support/helpers.php

    1. <?php
    2. function dp(...$vars)
    3. {
    4. foreach ($vars as $v) {
    5. var_dump($v);
    6. }
    7. }
    8. function session($key, $value = null)
    9. {
    10. $request = request();
    11. if ($value === null) {
    12. return $request->session()->get($key);
    13. } else {
    14. $request->session()->set($key, $value);
    15. }
    16. }
    17. # 获取并删除session key
    18. function sessionPull($key)
    19. {
    20. return request()->session()->pull($key);
    21. }