Hello Devs,
In this tutorial, we are going to learn how to use telescope in laravel.
Follow this step by step guide given below:
Installing Laravel Telescope:
composer require laravel/telescope
publish assests as follows:
php artisan telescope:install
php artisan migrate
/config/app.php
App\Providers\TelescopeServiceProvider::class,
app/Providers/AppServiceProvider.php
use App\Providers\TelescopeServiceProvider;
app/Providers/TelescopeServiceProvider.php
protected function gate()
{
Gate::define('viewTelescope', function ($user) {
return in_array($user->email, [
'user@email.com',
]);
});
}
return in_array($user->id, [
1, 2, 3,
]);
Run this command:
php artisan serve
Open this URL:
http://localhost:8000/telescope
I hope this example helps you.