PHP code example of zizaco / confide

1. Go to this page and download the library: Download zizaco/confide library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zizaco / confide example snippets


'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Zizaco\Confide\ServiceProvider',

),

'aliases' => array(

    'App'        => 'Illuminate\Support\Facades\App',
    'Artisan'    => 'Illuminate\Support\Facades\Artisan',
    ...
    'Confide'    => 'Zizaco\Confide\Facade',

),



use Zizaco\Confide\ConfideUser;
use Zizaco\Confide\ConfideUserInterface;

class User extends Eloquent implements ConfideUserInterface
{
    use ConfideUser;
}

class UsersTableSeeder extends Seeder {

    public function run()
    {
        $user = new User;
        $user->email = '[email protected]';
        $user->password = 'foo_bar_1234';
        $user->password_confirmation = 'foo_bar_1234';
        $user->confirmation_code = md5(uniqid(mt_rand(), true));
        $user->confirmed = 1;

        if(! $user->save()) {
            Log::info('Unable to create user '.$user->email, (array)$user->errors());
        } else {
            Log::info('Created user '.$user->email);
        }
    }
}

// app/models/MyOwnValidator.php
class MyOwnValidator implements UserValidatorInterface
{

    public function validate(ConfideUserInterface $user)
    {
        unset($user->password_confirmation);
        return true; // If the user valid
    }
}

// app/start/global.php
//...
App::bind('confide.user_validator', 'MyOwnValidator');

Confide::makeResetPasswordForm($token):

View::make(Config::get('confide::reset_password_form'))
    ->with('token', $token);

// filters.php

Route::filter('auth', function () {
    // If the user is not logged in
    if (Auth::guest()) {
        return Redirect::guest('users/login');
    }
});

// Only authenticated users will be able to access routes that begins with
// 'admin'. Ex: 'admin/posts', 'admin/categories'.
Route::when('admin*', 'auth');

// filters.php

Entrust::routeNeedsRole('admin*', 'Admin', function () {
    return Redirect::guest('users/login');
});
bash
$ php artisan confide:migration
bash
$ php artisan migrate
bash
$ php artisan confide:controller
$ php artisan confide:routes
bash
$ php artisan confide:controller --name=Employee
bash
$ php artisan confide:routes --controller=Employee
bash
$ php artisan confide:controller --name=MyProject\\Auth\\User
bash
$ php artisan config:publish zizaco/confide
bash
$ php artisan confide:controller --restful
bash
$ php artisan confide:routes --restful