Session
NghiaNV 8/16/2021
# Description
Cung cấp các phương thức thao tác đến session.
Service Register: Nin\Libs\Provider\SessionServiceProvider
Method:
all();
get(string $key);
set(string $key, $value);
has(string $key);
forget(string $key);
1
2
3
4
5
2
3
4
5
# Usage:
Resolved từ Container:
class HomeController
{
protected $session;
public function __construct(SessionContract $session) {
$this->session = $session;
}
public function index()
{
$session->get('session_key');
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Facade:
use Nin\Libs\Facades\Session;
Session::get('session_key');
//
use Nin\Libs\Facades\App;
$session = App::make(SessionContract::class);
$session->get('session_key');
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Packagist: https://packagist.org/packages/nin/nin (opens new window)