1. Go to this page and download the library: Download wp-kit/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/ */
namespace Theme\Controllers;
use Themosis\Route\BaseController;
use WPKit\Auth\Traits\AuthenticatesUsers;
use WPKit\Auth\Traits\ValidatesRequests;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers, ValidatesRequests;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
// an example in routes.php
Route::get('account', 'Example@showLoginForm');
Route::post('account', 'Example@login');
Route::get('logout', 'Example@logout');