Skip to content

Instantly share code, notes, and snippets.

View ahmadshobirin's full-sized avatar
😶‍🌫️

Ahmad Shobirin ahmadshobirin

😶‍🌫️
View GitHub Profile
@ahmadshobirin
ahmadshobirin / laravel, json
Created November 6, 2017 03:59
merge array with concate select to json
$data = [];
//ambil alamat asli customer
$customer = DB::table('m_customer')->select(DB::raw("CONCAT(m_customer.main_address,' - ',m_kelurahan_desa.name,' - ',m_kecamatan.name,' - ',m_kota_kab.type,' ',m_kota_kab.name) as address"))
->join('m_kelurahan_desa','m_kelurahan_desa.id','=','m_customer.main_kelurahan')
->join('m_kecamatan','m_kecamatan.id','=','m_kelurahan_desa.kecamatan')
->join('m_kota_kab','m_kota_kab.id','=','m_kecamatan.kota_kab')
->where('m_customer.id',$customerID)
->get();
//mencari alamat lainnya customer di m_alamat_customer
@ahmadshobirin
ahmadshobirin / laravel css
Created October 30, 2017 04:25
random css when looping
<?php $colors = ['bg-aqua','bg-green','bg-yellow','bg-red']; ?>
@foreach($dataGudang as $gudang)
<div class="col-lg-4 col-xs-8">
<!-- small box -->
<div class="small-box {{ $colors[rand(0,3)] }}">
</div>
</div>
@endforeach
@ahmadshobirin
ahmadshobirin / laravel, ajax
Created October 16, 2017 08:02
add content in table dynamically
/blade view
<div class="row">
<div class="col-md-12">
<button type="button" name="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal"> <i class="fa fa-pencil"></i> Add Produk</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-inverse">
@ahmadshobirin
ahmadshobirin / laravel
Created October 12, 2017 07:57
select ajax dynamically from database laravel
//my enviroment
// laravel 5.5
//in web.php
Route::get('admin/get-merk-product/{id}','ProductController@getMerk');
// in controller
use Response;
use App\MMerk;