本文整理汇总了PHP中Illuminate\Contracts\Encryption\Encrypter::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypter::encrypt方法的具体用法?PHP Encrypter::encrypt怎么用?PHP Encrypter::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Encryption\Encrypter
的用法示例。
在下文中一共展示了Encrypter::encrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param Repository $config
* @param Encrypter $encrypter
* @return string
*/
public function handle(Repository $config, Encrypter $encrypter)
{
$email = $encrypter->encrypt($this->user->getEmail());
$code = $encrypter->encrypt($this->user->getResetCode());
$query = "?email={$email}&code={$code}&redirect={$this->redirect}";
return $config->get('anomaly.module.users::paths.reset') . $query;
}
示例2: encrypt
/**
* Encrypt the cookies on an outgoing response.
*
* @param \Symfony\Component\HttpFoundation\Response $response
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function encrypt(Response $response)
{
foreach ($response->headers->getCookies() as $key => $cookie) {
$response->headers->setCookie($this->duplicate($cookie, $this->encrypter->encrypt($cookie->getValue())));
}
return $response;
}
示例3: getData
/**
* The data that is needed in the view
*
* @return mixed
*/
public function getData()
{
$params = ['project' => $this->user->pivot->project_id, 'user' => $this->user->id];
$userHash = $this->encrypter->encrypt($params);
$url = env('BASE_URL', 'http://knoters.com') . '/editor/' . $userHash;
return ['url' => $url];
}
示例4: time
function it_returns_the_timer_html(Encrypter $encrypter)
{
$time = time();
$encrypter->encrypt($time)->willReturn($time);
$html = (require __DIR__ . "/../../../src/Html/templates/timer.php");
$this->html()->shouldReturn($html);
}
示例5: encrypt
/**
* Encrypt the cookies on an outgoing response.
*
* @param \Symfony\Component\HttpFoundation\Response $response
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function encrypt(Response $response)
{
foreach ($response->headers->getCookies() as $cookie) {
if ($this->isDisabled($cookie->getName())) {
continue;
}
$response->headers->setCookie($this->duplicate($cookie, $this->encrypter->encrypt($cookie->getValue())));
}
return $response;
}
示例6: handle
/**
* Execute the job.
*
* @param Mailer $mailer
* @return void
*/
public function handle(Mailer $mailer, Encrypter $encrypter)
{
app()->setLocale($this->locale);
$token = $encrypter->encrypt(json_encode(['id' => $this->user->getKey(), 'expires' => time() + 3600 * 72]));
$user = $this->user;
$mailer->send('core::emails.activate', compact('user', 'token'), function ($message) use($user) {
$message->to($user->email);
$message->subject(trans('core::auth.emails.activate.subject'));
});
}
示例7: incrementOrDecrement
/**
* Increment or decrement an item in the cache.
*
* @param string $key
* @param mixed $value
* @param \Closure $callback
* @return void
*/
protected function incrementOrDecrement($key, $value, Closure $callback)
{
$prefixed = $this->prefix . $key;
$cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
if (!is_null($cache)) {
$current = $this->encrypter->decrypt($cache->value);
if (is_numeric($current)) {
$this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($callback($current))]);
}
}
}
示例8: set
/**
* Set a given setting value.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function set($key, $value = null)
{
$this->fire('setting', $key, [$key, $value]);
$generatedKey = $this->getKey($key);
$serializedValue = $this->serializeValue($value);
$this->repository->set($generatedKey, $this->isEncryptionEnabled() ? $this->encrypter->encrypt($serializedValue) : $serializedValue);
if ($this->isCacheEnabled()) {
$this->cache->forget($generatedKey);
}
$this->fire('set', $key, [$key, $value]);
$this->context(null);
}
示例9: locationUpdate
/**
* Fetch the list of Locations
*
* @Get("/", as="AdminLocationsIndex")
*/
public function locationUpdate($id, Encrypter $encrypter)
{
//echo $id;
$token = $encrypter->encrypt(csrf_token());
//$locations = DB::table('locations')->where('id', '=', $id)->first();
$query = "SELECT ld.`id` AS `location_id` , ld.`name` AS `location` , ld.`slug` AS `slug` , IF( la.`id` = ld.`id` , '', la.`id` ) AS `parent_id` , IF( la.`id` = ld.`id` , '', la.`name` ) AS `parent` , CAST( ld.type AS CHAR ) AS `location_type`\n FROM locations_tree AS `lt`\n INNER JOIN locations AS `ld` ON lt.`descendant` = ld.`id`\n INNER JOIN locations AS `la` ON lt.`ancestor` = la.`id`\n WHERE (lt.`length` =1 OR ld.`type` = 'Country') AND ld.id = '{$id}'";
$locations = DB::select($query);
/*print_r($locations);
echo $locations['0']->location_id;
exit;*/
return view('admin.settings.locationsupdate', ['_token' => $token, 'locations' => $locations]);
//return response()->json($locations->fetch($request->all()));
}
示例10: put
/**
* Store an item in the cache for a given number of minutes.
*
* @param string $key
* @param mixed $value
* @param int $minutes
* @return void
*/
public function put($key, $value, $minutes)
{
$key = $this->prefix . $key;
// All of the cached values in the database are encrypted in case this is used
// as a session data store by the consumer. We'll also calculate the expire
// time and place that on the table so we will check it on our retrieval.
$value = $this->encrypter->encrypt($value);
$expiration = $this->getTime() + $minutes * 60;
try {
$this->table()->insert(compact('key', 'value', 'expiration'));
} catch (Exception $e) {
$this->table()->where('key', '=', $key)->update(compact('value', 'expiration'));
}
}
示例11: incrementOrDecrement
/**
* Increment or decrement an item in the cache.
*
* @param string $key
* @param mixed $value
* @param \Closure $callback
* @return int|bool
*/
protected function incrementOrDecrement($key, $value, Closure $callback)
{
return $this->connection->transaction(function () use($key, $value, $callback) {
$prefixed = $this->prefix . $key;
$cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
if (is_null($cache)) {
return false;
}
$current = $this->encrypter->decrypt($cache->value);
$new = $callback($current, $value);
if (!is_numeric($current)) {
return false;
}
$this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($new)]);
return $new;
});
}
示例12: encryptPayload
/**
* Encrypt payload.
*
* @return string
*/
protected function encryptPayload()
{
$payload = json_encode($this->payload);
return $this->encrypter->encrypt($payload);
}
示例13: handle
/**
* Handle the command.
*
* @return string|null
*/
public function handle(Encrypter $encrypter)
{
$email = $encrypter->encrypt($this->user->getEmail());
$code = $encrypter->encrypt($this->user->getActivationCode());
return "/users/activate?email={$email}&code={$code}&redirect={$this->redirect}";
}
示例14: locations
/**
* Display the locations available for gourmetitup
*
* @Get("/locations", as="adminSettingsLocations")
* @return Response
*/
public function locations(Encrypter $encrypter)
{
$token = $encrypter->encrypt(csrf_token());
return view('admin.settings.locations', ['_token' => $token]);
}
示例15: put
/**
* Put an item into the storage.
*
* @param string $key
* @param string $data
*
* @return void
*/
public function put($key, $data)
{
$this->store->put($key, $this->encrypter->encrypt($data));
}