2017 © Pedro Peláez
 

library l4-confirm-action

Laravel 4 confirm user action

image

agelxnash/l4-confirm-action

Laravel 4 confirm user action

  • Monday, May 5, 2014
  • by Agel Nash
  • Repository
  • 2 Watchers
  • 2 Stars
  • 38 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Installation

Add l4-confirm-action to you composer.json file:, (*1)

"require": {
    "agelxnash/l4-confirm-action": "dev-master"
}

Now, run a composer update on the command line from the root of your project:, (*2)

composer update

Registering the Package

Add the L4ConfirmAction Service Provider to your config in app/config/app.php:, (*3)

'providers' => array(
    'AgelxNash\L4ConfirmAction\ConfirmServiceProvider'
),

If you use a Package Installer, you can run php artisan package:install agelxnash/l4-confirm-action, (*4)

Publish the config

Run this on the command line from the root of your project: php artisan config:publish agelxnash/l4-confirm-action This will publish L4ConfirmAction's config to app/config/packages/agelxnash/l4-confim-action/, (*5)

You may also want to change the 'classname' value if you want change action logic., (*6)

Migration

Now migrate the database tables for L4ConfirmAction. Run these on the command line from the root of your project: php artisan migrate --package="agelxnash/l4-confirm-action", (*7)

You must be have InnoDB table users with unsigned id field, (*8)

Usage

Sending confirmation email action to replace:, (*9)

$userObj = Auth::user();
$newMail = 'test@example.com';

$newHash = ConfirmUserAction::createHash($userObj->id, 'newMail', $newMail);
\Mail::send('emails.newMail', array(
    'hash' => $newHash
    'userObj' => $userObj->id
), function($message) use ($obj, $newMail){
    $message->from(Config::get('mail.from.address'))
        ->to($newMail)
        ->subject('Confirmation email change');
});

\Mail::send('emails.oldMail', array(
    'hash' => CChop\Helpers\User::confirum($userObj->id, 'oldMail', $userObj->email),
    'userObj' => $userObj,
    'newMail' => $newMail
), function($message) use ($userObj){
    $message->from(Config::get('mail.from.address'))
        ->to($userObj->email)
        ->subject('Notice of the request for a change of your email');
    }
);

emails.newMail blade, (*10)

Change e-mail: {{ URL::route('confirum', compact('hash')) }}

emails.oldMail blade, (*11)

Cancels the request to change email: {{ URL::route('confirum', compact('hash')) }}
To confirm the change, open a link from a letter sent by mail: {{ $newMail }}

The Versions

05/05 2014

dev-master

9999999-dev https://github.com/AgelxNash/l4-confirm-action

Laravel 4 confirm user action

  Sources   Download

MIT

The Requires

 

laravel user illuminate action confirm