lenses method. To attach a lens to a resource, you should simply add it to the array of lenses returned by this method:
make method to instantiate your lens. Any arguments passed to the make method will be passed to the constructor of your lens:
Authorization
If you would like to only expose a given lens to certain users, you may invoke thecanSee method when registering your lens. The canSee method accepts a closure which should return true or false. The closure will receive the incoming HTTP request:
Authorizable trait’s can method on our User model to determine if the authorized user is authorized for the viewValuableUsers action. However, since proxying to authorization policy methods is a common use-case for canSee, you may use the canSeeWhen method to achieve the same behavior. The canSeeWhen method has the same method signature as the Illuminate\Foundation\Auth\Access\Authorizable trait’s can method: