use Illuminate\Database\Eloquent\Model; use Reguard\Encryption\Encryption; class User extends Model { protected $encryptable = ['email']; public function setEmailAttribute($value) { $this->attributes['email'] = (new Encryption)->encrypt($value); } public function getEmailAttribute() { return (new Encryption)->decrypt($this->attributes['email']); } }
use Illuminate\Database\Eloquent\Model; use Reguard\Tokens\CSRF; class User extends Model { public function login() { CSRF::setToken(); // generate a CSRF token // perform login logic } public function logout() { CSRF::validateToken(); // validate the CSRF token // perform logout logic } }In this example, we are using the Reguard package's CSRF class to generate and validate CSRF tokens. CSRF protection is important for safeguarding your application against malicious attacks. Based on the code examples, it looks like the Reguard package is a security package that provides various features such as encryption, CSRF protection, and more.