Skip to content

Instantly share code, notes, and snippets.

<?php
$provinces = \Illuminate\Support\Facades\DB::table('lokasi')
->where('tingkat', 1)
->orderBy('nama')
->get();
$allKabupaten = \Illuminate\Support\Facades\DB::table('lokasi')
->where('tingkat', 2)
->whereIn('parent_id', $provinces->pluck('id'))
@renandatta
renandatta / migration_to_model.php
Created November 27, 2025 04:04
Generate model table name and fillable. for now it worked in indonesian table names
<?php
class MigrationToModelUpdater
{
protected $migrationsPath;
protected $modelsPath;
public function __construct($migrationsPath = null, $modelsPath = null)
{
$this->migrationsPath = $migrationsPath ?: __DIR__ . '/database/migrations';
@renandatta
renandatta / openlayers_openstreetmap.js
Created July 15, 2020 07:20
Initiate OpenLayers Map, Polygon, Marker, and Free Geocode
/// ======= initiate map
let map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({