DeveloperBreeze

Laravel Api Development Tutorials, Guides & Insights

Unlock 1+ expert-curated laravel api tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your laravel api skills on DeveloperBreeze.

Creating Personal Access Tokens for a Custom Model in Laravel

Tutorial October 24, 2024

Here’s an example of generating a token for a customer:

$customer = Customer::find($customerId); // Replace $customerId with the actual customer ID
$token = $customer->createToken('customer-token'); // 'customer-token' is the token name
$accessToken = $token->plainTextToken; // This is the plain text token