authenticated basic token in api laravel code example
Example 1: how to change laravel 8 login credentials
Fortify::authenticateUsing(function (LoginRequest $request) {
$user = User::where('user_name', $request->user_name);
if (
$user &&
Hash::check($request->password, $user->password)
) {
return $user;
}
});
'username' => 'user_name',
Example 2: encrypt api token laravel
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCEOSTable extends Migration
{
public function up()
{
Schema::create('c_e_o_s', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('company_name');
$table->year('year');
$table->string('company_headquarters');
$table->string('what_company_does');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('c_e_o_s');
}
}