Beispiel #1
0
 /**
  * return model fields in proper way.
  *
  * @param $record
  * @param $col
  *
  * @return mixed
  */
 public function renderTableRow($record, $col)
 {
     switch (array_get($col, 'type', 'text')) {
         case 'yes_no':
             return $record->yes_no($record->{$col['db_field']});
             break;
         case 'format_default_date':
             return $record->formatDefaultData($record->{$col['db_field']});
             break;
         case 'sort':
             return '<div class="fa fa-sort sortable-handle"></div>';
             break;
         case 'relation':
             return $record->{$col['relation']}->{$col['db_field']};
             break;
         case 'translation':
             $locale = config('app.locale', 'en');
             $i18n = I18n::select('id')->where('locale', $locale)->first();
             if ($i18n) {
                 $i18nId = $i18n->id;
                 return $record->translate(1)->{$col['db_field']};
             }
             return 'No translation';
             break;
         default:
             return $record->{$col['db_field']};
             break;
     }
 }
Beispiel #2
0
<?php

$i18ns = \Despark\Cms\Models\I18n::all();
?>
@if(!empty($i18ns))
  <div role="tabpanel">
    <ul class="nav nav-tabs" role="tablist">
        @foreach($i18ns as $key => $i18n)
            @if($key == 0)
                <li role="presentation" class="active">
            @else
                <li role="presentation">
            @endif
            <a href="#{{$i18n->id}}" aria-controls="{{$i18n->id}}" role="tab" data-toggle="tab">{{$i18n->name}}</a></li>
        @endforeach
    </ul>

    <div class="tab-content">
        @foreach($i18ns as $key => $i18n)
            @if($key == 0)
                <div role="tabpanel" class="tab-pane active" id="{{$i18n->id}}">
            @else
                <div role="tabpanel" class="tab-pane" id="{{$i18n->id}}">
            @endif
                @include('ignicms::i18n.'.$model->getTable().'.form', array('model' => $model->translate((int) $i18n->id), 'i18n' => $i18n))
                </div>
        @endforeach
    </div>
@endif