Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Default first item #70

Open
josegus opened this issue May 17, 2019 · 1 comment
Open

Default first item #70

josegus opened this issue May 17, 2019 · 1 comment

Comments

@josegus
Copy link

josegus commented May 17, 2019

I need to render categories as dropdown, but need the first element to be empty. How can i set a default "Select one" with empty value and custom text?

@mgazelle
Copy link

mgazelle commented Jun 9, 2019

Just add placeholder('','None') before calling the render function.

Example:

<?php

Category::attr(['name' => 'categories'])
    ->selected(2)
    ->placeholder('','None')
    ->renderAsDropdown();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants