Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Other Form Fields: Radio and Checkbox

Premium
3 min read

In this lesson, let's see how easy it is to work with other form fields.

radio and checkbox inputs


Prepare DB

We need to prepare the DB quickly before adding other fields to the form.

dabatase/migrations/xxxx_add_radio_and_checkbox_select_to_products_table.php:

Schema::table('products', function (Blueprint $table) {
$table->string('color');
$table->boolean('in_stock')->default(true);
});

app/Models/Product.php:

class Product extends Model
{
protected $fillable = [
'name',
'description',
'category_id',
'color',
'in_stock',
];
 
const COLOR_LIST = [
'red' => 'Red',
'green' => 'Green',
'blue' => 'Blue',
];
 
// ...
}

We will use COLOR_LIST cons to quickly show colors in the form.


Add Fields to Livewire Form

Now let's show...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.