Laravel web rest api authentication library.
First set your .env variables (mysql, smtp) and then
composer require atomjoy/webi
// app/Models/User.php
<?php
namespace App\Models;
use Webi\Models\WebiUser;
class User extends WebiUser
{
function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->mergeFillable([
// 'mobile', 'website'
]);
$this->mergeCasts([
// 'status' => StatusEnum::class,
// 'email_verified_at' => 'datetime:Y-m-d H:i:s',
]);
// $this->hidden[] = 'secret_hash';
}
protected $dispatchesEvents = [
// 'saved' => UserSaved::class,
// 'deleted' => UserDeleted::class,
];
}
// routes/web.php
Route::get('/login', function() {
return 'My login page'; // return view('vue');
})->name('login');
// routes/web.php
use Webi\Http\Controllers\WebiActivate;
// Create your own activation page for Vue, Laravel
Route::get('/activate/{id}/{code}', [YourActivationController::class, 'index'])->middleware(['webi-locale']);
// Or for tests use json controller from Webi\Http\Controllers\WebiActivate.php
Route::get('/activate/{id}/{code}', [WebiActivate::class, 'index'])->middleware(['webi-locale']);
php artisan lang:publish
php artisan vendor:publish --tag=webi-lang-en --force
php artisan vendor:publish --tag=webi-lang-pl --force
# Create tables
php artisan migrate
# Refresh tables
php artisan migrate:fresh
# Seed data (optional)
php artisan db:seed --class=WebiSeeder
php artisan serve
Tests readme file location
tests/README.md
# Edit email blade themes
php artisan vendor:publish --tag=webi-email
# Edit lang translations
php artisan vendor:publish --tag=webi-lang
# Edit config
php artisan vendor:publish --tag=webi-config
# Override config
php artisan vendor:publish --tag=webi-config --force
# Add the image logo to your mail
php artisan vendor:publish --tag=webi-public
# Provider
php artisan vendor:publish --provider="Webi\WebiServiceProvider.php"
php artisan db:seed --class=WebiSeeder
composer update
composer dump-autoload -o
composer update --no-dev
Send requests as json. Response as json: {'message', "user"}. For more go to: src/Http/Requests and src\Http\Controllers directories or to routes file routes/web.php.
Method: POST
Params: 'email', 'password', 'remember_me'
Data: {'message', "user"}
Method: POST
Params: 'name', 'email', 'password', 'password_confirmation'
Data: {'message', 'created'}
Method: POST
Params: 'email'
Data: {'message'}
Method: GET
Params: 'id', 'code'
Data: {'message'}
Method: GET
Params: without params
Data: {'message'}
Method: GET
Params: 'locale'
Data: {'message', 'locale'}
Method: GET
Params: without params
Data: {'message', 'counter', 'locale'}
Method: GET
Params: without params
Data: {'message', 'locale', "user"}
Method: POST Auth: true
Params: 'password_current', 'password', 'password_confirmation'
Data: {'message'}
Method: GET Auth: true
Params: without params
Data: {'message', "user", 'ip'}