Laravel 8 Install Telescope Tutorial Example

Admin   Laravel   242  2021-03-17 23:00:07

Hi Guys,

In this tutorial,I will learn you how to install telescope in laravel 8.you can easy and simply use telescope in laravel 8.

Laravel Telescope is an elegant debug assistant for the Laravel framework.You can create laravel website and application then useful get debug and information rediable formate provide to laravel telescope.

You can use Laravel Telescope to debug your requests, exceptions, databases, cache, and much more in real time by accessing a specific route in your local environment.

Installing Laravel Telescope:

First step,you can install package in composer.

 

composer require laravel/telescope

If you are only using Telescope in your local environment you can add the --dev flag as below

 

composer require laravel/telescope --dev

You’ll then need to publish its assets and run a database migration using the following:

 

php artisan telescope:install

php artisan migrate

If you will use local environment then remove this line Application Service Providers section.

/config/app.php

 

App\Providers\TelescopeServiceProvider::class,

Then add to provider following

app/Providers/AppServiceProvider.php

 

use App\Providers\TelescopeServiceProvider;

And register() method

 

if ($this->app->isLocal()) {

$this->app->register(TelescopeServiceProvider::class);

}

If you are using Telescope in a production environment then by default only specified users will be able to access the Telescope dashboard. These can be added in the gate() method of the

app/Providers/TelescopeServiceProvider.php

 

protected function gate()

{

Gate::define('viewTelescope', function ($user) {

return in_array($user->email, [

'[email protected]',

]);

});

}

you can choose specify id in array.

 

return in_array($user->id, [

1, 2, 3,

]);

Now you can run using bellow command:

 

php artisan serve

Open bellow URL:

 

http://localhost:8000/telescope

It will help you....