Check if Email Exists When Leaving Reviews Php

Laravel Telescope

  • Introduction
  • Installation
    • Local Merely Installation
    • Configuration
    • Information Pruning
    • Dashboard Authority
  • Upgrading Telescope
  • Filtering
    • Entries
    • Batches
  • Tagging
  • Available Watchers
    • Batch Watcher
    • Cache Watcher
    • Command Watcher
    • Dump Watcher
    • Event Watcher
    • Exception Watcher
    • Gate Watcher
    • HTTP Client Watcher
    • Task Watcher
    • Log Watcher
    • Mail Watcher
    • Model Watcher
    • Notification Watcher
    • Query Watcher
    • Redis Watcher
    • Asking Watcher
    • Schedule Watcher
    • View Watcher
  • Displaying User Avatars

Introduction

Laravel Telescope makes a wonderful companion to your local Laravel development environment. Telescope provides insight into the requests coming into your awarding, exceptions, log entries, database queries, queued jobs, mail service, notifications, cache operations, scheduled tasks, variable dumps, and more.

Installation

Yous may use the Composer package manager to install Telescope into your Laravel projection:

                                        

composer require laravel/telescope

After installing Telescope, publish its avails using the telescope:install Artisan command. After installing Telescope, y'all should also run the migrate control in lodge to create the tables needed to store Telescope'south information:

                                        

php artisan telescope:install

php artisan drift

Migration Customization

If you are non going to apply Telescope's default migrations, you should call the Telescope::ignoreMigrations method in the annals method of your application'due south App\Providers\AppServiceProvider class. You may export the default migrations using the following command: php artisan vendor:publish --tag=telescope-migrations

Local Simply Installation

If you lot plan to only utilise Telescope to assist your local development, you may install Telescope using the --dev flag:

                                        

composer require laravel/telescope --dev

php artisan telescope:install

php artisan migrate

Later on running telescope:install, you should remove the TelescopeServiceProvider service provider registration from your awarding'south config/app.php configuration file. Instead, manually register Telescope's service providers in the register method of your App\Providers\AppServiceProvider class. We will ensure the current environment is local before registering the providers:

                                        

/**

* Register whatever application services.

*

* @return void

*/

public function register ()

{

if ( $this ->app-> environment ( ' local ' )) {

$this ->app-> register (\Laravel\Telescope\ TelescopeServiceProvider :: course );

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

}

}

Finally, yous should besides prevent the Telescope parcel from existence auto-discovered by adding the following to your composer.json file:

                                        

" extra " : {

"laravel" : {

"dont-notice" : [

" laravel/telescope "

]

}

},

Configuration

After publishing Telescope's assets, its primary configuration file will exist located at config/telescope.php. This configuration file allows y'all to configure your watcher options. Each configuration choice includes a description of its purpose, so exist sure to thoroughly explore this file.

If desired, you may disable Telescope's information collection entirely using the enabled configuration option:

                                        

' enabled ' => env ( ' TELESCOPE_ENABLED ' , truthful ),

Data Pruning

Without pruning, the telescope_entries table tin can accumulate records very quickly. To mitigate this, you lot should schedule the telescope:prune Artisan command to run daily:

                                        

$schedule -> command ( ' telescope:clip ' ) -> daily ();

By default, all entries older than 24 hours volition be pruned. You may use the hours option when calling the control to determine how long to retain Telescope data. For example, the following control will delete all records created over 48 hours ago:

                                        

$schedule -> command ( ' telescope:prune --hours=48 ' ) -> daily ();

Dashboard Authorization

The Telescope dashboard may exist accessed at the /telescope route. By default, you will just be able to access this dashboard in the local environment. Within your app/Providers/TelescopeServiceProvider.php file, in that location is an authorization gate definition. This potency gate controls access to Telescope in non-local environments. Y'all are free to alter this gate as needed to restrict access to your Telescope installation:

                                        

/**

* Annals the Telescope gate.

*

* This gate determines who can access Telescope in non-local environments.

*

* @render void

*/

protected part gate ()

{

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

return in_array ($ user ->electronic mail , [

' [email protected] ' ,

]);

});

}

{note} You should ensure yous change your APP_ENV environment variable to production in your production environment. Otherwise, your Telescope installation will exist publicly available.

Upgrading Telescope

When upgrading to a new major version of Telescope, information technology's important that yous carefully review the upgrade guide.

In addition, when upgrading to whatever new Telescope version, yous should re-publish Telescope'due south avails:

                                        

php artisan telescope:publish

To keep the assets up-to-engagement and avoid issues in future updates, you may add the telescope:publish command to the post-update-cmd scripts in your application'southward composer.json file:

                                        

{

"scripts" : {

"post-update-cmd" : [

" @php artisan telescope:publish --ansi "

]

}

}

Filtering

Entries

You may filter the data that is recorded by Telescope via the filter closure that is defined in your App\Providers\TelescopeServiceProvider class. By default, this closure records all information in the local environment and exceptions, failed jobs, scheduled tasks, and data with monitored tags in all other environments:

                                        

use Laravel\Telescope\ IncomingEntry ;

use Laravel\Telescope\ Telescope ;

/**

* Register whatsoever application services.

*

* @return void

*/

public function register ()

{

$this -> hideSensitiveRequestDetails ();

Telescope :: filter ( function ( IncomingEntry $entry ) {

if ( $this ->app-> environs ( ' local ' )) {

return true ;

}

return $entry -> isReportableException () ||

$entry -> isFailedJob () ||

$entry -> isScheduledTask () ||

$entry -> isSlowQuery () ||

$entry -> hasMonitoredTag ();

});

}

Batches

While the filter closure filters data for individual entries, you may use the filterBatch method to annals a closure that filters all data for a given request or console command. If the closure returns truthful, all of the entries are recorded by Telescope:

                                        

use Illuminate\Support\ Collection ;

use Laravel\Telescope\ Telescope ;

/**

* Register any awarding services.

*

* @return void

*/

public office annals ()

{

$this -> hideSensitiveRequestDetails ();

Telescope :: filterBatch ( function ( Collection $entries ) {

if ( $this ->app-> environs ( ' local ' )) {

return truthful ;

}

return $entries -> contains ( office ( $entry ) {

return $entry -> isReportableException () ||

$entry -> isFailedJob () ||

$entry -> isScheduledTask () ||

$entry -> isSlowQuery () ||

$entry -> hasMonitoredTag ();

});

});

}

Tagging

Telescope allows you to search entries by "tag". Often, tags are Eloquent model class names or authenticated user IDs which Telescope automatically adds to entries. Occasionally, you may want to attach your ain custom tags to entries. To achieve this, you may use the Telescope::tag method. The tag method accepts a closure which should return an array of tags. The tags returned by the closure will be merged with any tags Telescope would automatically attach to the entry. Typically, you lot should call the tag method within the register method of your App\Providers\TelescopeServiceProvider form:

                                        

use Laravel\Telescope\ IncomingEntry ;

use Laravel\Telescope\ Telescope ;

/**

* Register any application services.

*

* @return void

*/

public part register ()

{

$this -> hideSensitiveRequestDetails ();

Telescope :: tag ( part ( IncomingEntry $entry ) {

return $entry ->blazon === ' request '

? [ ' status: ' . $entry ->content [ ' response_status ' ]]

: [];

});

}

Bachelor Watchers

Telescope "watchers" gather application data when a request or panel control is executed. You lot may customize the list of watchers that you lot would like to enable within your config/telescope.php configuration file:

                                        

' watchers ' => [

Watchers\ CacheWatcher :: course => truthful ,

Watchers\ CommandWatcher :: grade => truthful ,

...

],

Some watchers also allow you to provide additional customization options:

                                        

' watchers ' => [

Watchers\ QueryWatcher :: course => [

' enabled ' => env ( ' TELESCOPE_QUERY_WATCHER ' , truthful ),

' ho-hum ' => 100 ,

],

...

],

Batch Watcher

The batch watcher records information well-nigh queued batches, including the job and connection data.

Cache Watcher

The enshroud watcher records data when a cache key is hitting, missed, updated and forgotten.

Command Watcher

The command watcher records the arguments, options, exit code, and output whenever an Artisan control is executed. If you would like to exclude sure commands from beingness recorded by the watcher, yous may specify the control in the ignore option within your config/telescope.php file:

                                        

' watchers ' => [

Watchers\ CommandWatcher :: form => [

' enabled ' => env ( ' TELESCOPE_COMMAND_WATCHER ' , truthful ),

' ignore ' => [ ' key:generate ' ],

],

...

],

Dump Watcher

The dump watcher records and displays your variable dumps in Telescope. When using Laravel, variables may be dumped using the global dump function. The dump watcher tab must be open up in a browser for the dump to be recorded, otherwise, the dumps will be ignored by the watcher.

Result Watcher

The event watcher records the payload, listeners, and circulate information for any events dispatched by your application. The Laravel framework'southward internal events are ignored by the Outcome watcher.

Exception Watcher

The exception watcher records the data and stack trace for whatever reportable exceptions that are thrown by your awarding.

Gate Watcher

The gate watcher records the data and result of gate and policy checks past your application. If you would like to exclude certain abilities from beingness recorded past the watcher, you may specify those in the ignore_abilities option in your config/telescope.php file:

                                        

' watchers ' => [

Watchers\ GateWatcher :: class => [

' enabled ' => env ( ' TELESCOPE_GATE_WATCHER ' , true ),

' ignore_abilities ' => [ ' viewNova ' ],

],

...

],

HTTP Client Watcher

The HTTP client watcher records approachable HTTP client requests made by your application.

Job Watcher

The task watcher records the data and condition of whatsoever jobs dispatched past your awarding.

Log Watcher

The log watcher records the log data for any logs written by your application.

Mail Watcher

The mail service watcher allows y'all to view an in-browser preview of emails sent by your application along with their associated information. You may also download the email as an .eml file.

Model Watcher

The model watcher records model changes whenever an Eloquent model event is dispatched. You may specify which model events should be recorded via the watcher'due south events selection:

                                        

' watchers ' => [

Watchers\ ModelWatcher :: class => [

' enabled ' => env ( ' TELESCOPE_MODEL_WATCHER ' , truthful ),

' events ' => [ ' eloquent.created* ' , ' eloquent.updated* ' ],

],

...

],

If you lot would like to tape the number of models hydrated during a given request, enable the hydrations option:

                                        

' watchers ' => [

Watchers\ ModelWatcher :: class => [

' enabled ' => env ( ' TELESCOPE_MODEL_WATCHER ' , true ),

' events ' => [ ' eloquent.created* ' , ' eloquent.updated* ' ],

' hydrations ' => truthful ,

],

...

],

Notification Watcher

The notification watcher records all notifications sent past your application. If the notification triggers an email and y'all have the mail watcher enabled, the email will also be bachelor for preview on the post watcher screen.

Query Watcher

The query watcher records the raw SQL, bindings, and execution time for all queries that are executed past your awarding. The watcher too tags whatsoever queries slower than 100 milliseconds every bit slow. You may customize the wearisome query threshold using the watcher's tedious option:

                                        

' watchers ' => [

Watchers\ QueryWatcher :: class => [

' enabled ' => env ( ' TELESCOPE_QUERY_WATCHER ' , true ),

' slow ' => l ,

],

...

],

Redis Watcher

The Redis watcher records all Redis commands executed by your application. If you are using Redis for caching, enshroud commands will also be recorded by the Redis watcher.

Request Watcher

The request watcher records the request, headers, session, and response information associated with any requests handled by the awarding. You may limit your recorded response data via the size_limit (in kilobytes) option:

                                        

' watchers ' => [

Watchers\ RequestWatcher :: course => [

' enabled ' => env ( ' TELESCOPE_REQUEST_WATCHER ' , true ),

' size_limit ' => env ( ' TELESCOPE_RESPONSE_SIZE_LIMIT ' , 64 ),

],

...

],

Schedule Watcher

The schedule watcher records the command and output of any scheduled tasks run by your application.

View Watcher

The view watcher records the view proper noun, path, data, and "composers" used when rendering views.

Displaying User Avatars

The Telescope dashboard displays the user avatar for the user that was authenticated when a given entry was saved. By default, Telescope will think avatars using the Gravatar web service. All the same, you may customize the avatar URL by registering a callback in your App\Providers\TelescopeServiceProvider class. The callback volition receive the user's ID and email accost and should render the user's avatar image URL:

                                        

use App\Models\ User ;

use Laravel\Telescope\ Telescope ;

/**

* Annals whatsoever application services.

*

* @return void

*/

public function annals ()

{

// ...

Telescope :: avatar ( function ( $id , $email ) {

return '/ avatars /' . User :: discover ( $id ) ->avatar_path ;

});

}

barnesobtionve.blogspot.com

Source: https://laravel.com/docs/9.x/telescope

0 Response to "Check if Email Exists When Leaving Reviews Php"

Enviar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel