Skip to content

Instantly share code, notes, and snippets.

@todiadiyatmo
Last active April 30, 2016 04:10
Show Gist options
  • Select an option

  • Save todiadiyatmo/425d91430db1b4fb7cda to your computer and use it in GitHub Desktop.

Select an option

Save todiadiyatmo/425d91430db1b4fb7cda to your computer and use it in GitHub Desktop.
Laravel Start

JWT vs CSRF

  • Remove CSRF from middleware -> move to routed middleware

Mandrill

composer require "guzzlehttp/guzzle": "~5.3|~6.0"
MAIL_DRIVER=mandrill
MANDRILL_SECRET=YOUR_SECRET
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SENDER_NAME=YOUR_NAME
SENDER_ADDRES=YOUR_FROM_EMAIL

Append

protected $appends = ['taxonomies'];

public function getTaxonomiesAttribute()
{
    return $this->attributes['taxonomies'] == 'yes';
}

Date

<div class="form-group">
    <label class="col-sm-2 control-label">Tanggal Bayar</label>
    <div class="col-sm-3">
         <div class='input-group date' id='datetimepicker_perawat'>
           {!! Form::input('text','tanggal_bayar', $pembayaran->tanggal_bayar->format('j/n/Y') , ['class'=> 'form-control']) !!}
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </div>
</div>
function getTanggalBayarFormat()
{
    return "j/n/Y";
}

function getTanggalBayarAttribute($tanggal_bayar)
{
    if(!$tanggal_bayar)
    {
        return Carbon::now();
    }

    return new Carbon($tanggal_bayar);
}



function setTanggalBayarAttribute($tanggal_bayar)
{
    if( is_string($tanggal_bayar) )
        $this->attributes['tanggal_bayar'] = Carbon::createFromFormat('j/n/Y', $tanggal_bayar);
    else
        $this->attributes['tanggal_bayar'] = $tanggal_bayar;
}

Select2 Angular Auto Complete

<ui-select ng-model="selected[$index]" ng-change='updateLineItemProduct(lineItem,$select.selected)'>
    <ui-select-match placeholder="Pilih product">
        <span>@{{$select.selected.taxonomies.product_type[0].root_term_description}} - @{{$select.selected.name}}</span>
    </ui-select-match>
    <ui-select-choices 
        refresh="refreshProducts($select.search)"
        refresh-delay="1"
        repeat="product in (productArray | filter: $select.search) track by product.id">
        <span>@{{product.taxonomies.product_type[0].root_term_description}} - @{{product.name}}</span>
    </ui-select-choices>
</ui-select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment