PHP code example of reshadman / laravel-mongo-auth
1. Go to this page and download the library: Download reshadman/laravel-mongo-auth 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/ */
reshadman / laravel-mongo-auth example snippets
artisan vendor:publish
return [
//...
'driver' => 'lmauth'
];
$this->app['auth']->extend('lmauth', function(Application $app){
$config = $app['config']->get('lmauth');
return new MongoDbUserProvider(
$app['lmauth.collection'], // Should be bound to an instance of \MongoCollection
$app['hash'],
$config
);
});
Auth::extend('my-lmauth', function($app) {
$config = $app['config']->get('lmauth'); // or your desired
$mongoCollection = $app['global_mongo_connection']->myDb->myCollection;
return new \Reshadman\LmAuth\MongoDbUserProvider($mongoCollection, $app['hash'], $config);
});
return [
//...
'default_connection_closure' => function($app) {
return new \MongoClient('192.168.0.2:27013'); // or $app['mongo.singleton_connection']
}
];
auth.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.