Last active
November 10, 2021 18:18
-
-
Save rukshn/c5fee0d4187acbddd900ce4dba6d6835 to your computer and use it in GitHub Desktop.
Simple Blade Components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@props(['value', 'name']) | |
@php | |
$districts = ['Ampara', 'Anuradhapura', 'Badulla', 'Batticaloa', 'Colombo', | |
'Galle', 'Gampaha', 'Hambanthota', 'Jaffna', 'Kaluthara', 'Kandy', | |
'Kegalle', 'Killinochchi', 'Kurunagala', 'Mannar', 'Matale', 'Mathara', | |
'Monaragala', 'Mullathivu', 'Nuwara Eliya', 'Polonnaruwa', 'Puttalam', | |
'Rathnapura', 'Trincomalee', 'Vavuniya'] | |
@endphp | |
<select name="{{ $name }}" class="w-full mt-1 rounded-md border-2 border-gray-300 focus:border-indigo-500 focus:ring-0"> | |
@foreach ($districts as $district) | |
<option @if ($value == $loop->index+1) selected @endif value="{{ $loop->index+1 }}">{{ $district }}</option> | |
@endforeach | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@props(['value', 'name']) | |
@php | |
$provinces = ['Western', 'Southern', 'Sabaragamuwa', 'Nothern', | |
'Uva', 'North Western', 'Northern', 'North Central', 'Eastern'] | |
@endphp | |
<select name="{{ $name }}" class="w-full mt-1 rounded-md border-2 border-gray-300 focus:border-indigo-500 focus:ring-0"> | |
@foreach ($provinces as $province) | |
<option @if ($value == $loop->index+1) selected @endif value="{{ $loop->index+1 }}">{{ $province }}</option> | |
@endforeach | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment