Skip to content
On this page

Hidden

When using Quick Models or Custom Models, Larawiz will automatically set as hidden any attribute that contains the words:

  • password,
  • token (like remember_token),
  • secret,
  • private,
  • or hidden.
yaml
models:
  User:
    name: string
    email: string
    password: string
    auth_token: string
    rememberToken: ~
  Post:
    columns: 
      title: string
      body: text
      private_notes: json
      hidden_informer: string
1
2
3
4
5
6
7
8
9
10
11
12
13
php
class User extends Authenticatable
{
    protected $hidden = [
        'password', 'auth_token', 'remember_token'
    ];
}

class Post extends Model
{
    protected $hidden = [
        'private_notes', 'hidden_informer'
    ];
}
1
2
3
4
5
6
7
8
9
10
11
12
13

Override hidden attributes

You may use the hidden key inside the model declaration to override the list of attributes that should be hidden. Larawiz won't check if these attributes exist or not.

yaml
models:
  Post:
    columns: 
      title: string
      body: text
      private_notes: json
      editor_notes: json
      magic_token: string
    hidden:
      - author_notes
      - private_notes
1
2
3
4
5
6
7
8
9
10
11
php
class Post extends Model
{
    protected $hidden = [
        'author_notes', 'private_notes',
    ];
}
1
2
3
4
5
6

No hidden attributes

Alternatively, you can make all attributes visible by issuing hidden with false.

yaml
models:
  Post:
    columns: 
      title: string
      body: text
      private_notes: json
      editor_notes: json
    hidden: false
1
2
3
4
5
6
7
8