Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Http\Concerns;
4
 
5
use Illuminate\Database\Eloquent\Model;
6
 
7
trait InteractsWithFlashData
8
{
9
    /**
10
     * Retrieve an old input item.
11
     *
12
     * @param  string|null  $key
13
     * @param  \Illuminate\Database\Eloquent\Model|string|array|null  $default
14
     * @return string|array|null
15
     */
16
    public function old($key = null, $default = null)
17
    {
18
        $default = $default instanceof Model ? $default->getAttribute($key) : $default;
19
 
20
        return $this->hasSession() ? $this->session()->getOldInput($key, $default) : $default;
21
    }
22
 
23
    /**
24
     * Flash the input for the current request to the session.
25
     *
26
     * @return void
27
     */
28
    public function flash()
29
    {
30
        $this->session()->flashInput($this->input());
31
    }
32
 
33
    /**
34
     * Flash only some of the input to the session.
35
     *
36
     * @param  array|mixed  $keys
37
     * @return void
38
     */
39
    public function flashOnly($keys)
40
    {
41
        $this->session()->flashInput(
42
            $this->only(is_array($keys) ? $keys : func_get_args())
43
        );
44
    }
45
 
46
    /**
47
     * Flash only some of the input to the session.
48
     *
49
     * @param  array|mixed  $keys
50
     * @return void
51
     */
52
    public function flashExcept($keys)
53
    {
54
        $this->session()->flashInput(
55
            $this->except(is_array($keys) ? $keys : func_get_args())
56
        );
57
    }
58
 
59
    /**
60
     * Flush all of the old input from the session.
61
     *
62
     * @return void
63
     */
64
    public function flush()
65
    {
66
        $this->session()->flashInput([]);
67
    }
68
}