Skip to content

Instantly share code, notes, and snippets.

View batbaatap's full-sized avatar
🏠
Working from home

batbaatap

🏠
Working from home
View GitHub Profile
@batbaatap
batbaatap / index.html
Created August 12, 2019 06:14
Vue array multi-filter
<div id="app">
<template v-for="tag in tags">
<input type="checkbox" value="{{ tag }}" v-model="selectedTags" id="tag-{{ tag }}">
<label for="tag-{{ tag }}">{{ tag }}</label>
</template>
<p v-show="selectedTags.length != 0">
Filters: <span v-for="tag in selectedTags" class="label">{{ tag }}</span>
</p>
<ul>
<li v-for="card in activeCards">{{ card.name }}</li>
@batbaatap
batbaatap / validation.php
Last active May 9, 2021 03:19
Date, check id in table
<?php
$request->validate([
'bookings' => 'required|array|min:1',
'bookings.*.hotelId' => 'required|exists:pm_hotel,id', // check id in pm_hotel
'bookings.*.from' => 'required|date',
'bookings.*.to' => 'required|date|after:bookings.*.from',
'bookings.*.night' => 'required|numeric|min:0|not_in:0',
'customer.first_name' => 'required|min:2',