Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Chron's avatar

Any way to pass Laravel's validation rules to Vue?

I'm trying to make a word counter in a textbox.


//StoreTodoRequest.php

public function rules(): array
    {
        return [
            'name' => 'required|max:50',
		];
	}
// Vue
<textbox-limiter :limit=50 />

Is there any way to get the rules or is it better to just hardcode it?

0 likes
3 replies
Chron's avatar

@jlrdw Thanks for responding! I know how to display errors but I want to know how to get the rules not the errors thrown by the rules. I want to use it in vue like this

// Vue
<textbox-limiter :limit="laravel.rule.name.max" />

Please or to participate in this conversation.