1. Go to this page and download the library: Download mindtwo/px-user-laravel 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/ */
mindtwo / px-user-laravel example snippets
use mindtwo\PxUserLaravel\Traits\UseUserDataCache;
class User extends Model
{
use UseUserDataCache;
}
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use mindtwo\PxUserLaravel\Actions\PxUserLoginAction;
class LoginController extends Controller
{
public function __construct(
protected PxUserLoginAction $pxUserLoginAction,
) {
}
/**
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*
* @throws Exception
*/
public function login(Request $request)
{
// received token auth data via PX User widgets
$tokenData = $request->only([
'access_token',
'access_token_lifetime_minutes',
'access_token_expiration_utc',
'refresh_token',
'refresh_token_lifetime_minutes',
'refresh_token_expiration_utc',
]);
$result = $this->pxUserLoginAction->execute($tokenData);
return response()->json(['success' => $result]);
}
}
bash
php artisan vendor:publish px-user
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.