}); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['as' => 'home', 'uses' => 'HomeController@index']); Route::get('home', ['as' => 'home', 'uses' => 'HomeController@index']); // AUTH CONTROLLERS Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); // USER Route::resource('user', 'UserController'); post('update/{user_id}/role', ['as' => 'update_role', 'uses' => 'UserController@updateRoles']); // INFORMATION Route::resource('information', 'InformationController', ['only' => ['store', 'update', 'index']]); // FIELD Route::bind('field', function ($id) { return App\Field::whereId($id)->first(); }); Route::resource('field', 'FieldController'); // SOA HISTORY Route::group(['middleware' => 'auth'], function () { get('import/payment_history', ['as' => 'import_payment_history', 'uses' => 'InformationController@showImportPaymentHistory']); get('import/soa_history', ['as' => 'import_soa_history', 'uses' => 'InformationController@showImportSoaHistory']); }); post('import_field/information', ['as' => 'importInformation', 'uses' => 'InformationController@importInformation']);
</center> @elseif($relation->pivot->laravel_name == 'belongsToMany') <center> <p> <i class="fa fa-arrow-right"></i> <a href="{{route('admin.devis.{devis}.tables.edit_table_relation', [$devis->id, $relation->pivot->from_field_id,$relation->pivot->to_field_id])}}"> <b style="color:orangered">{{$relation->pivot->laravel_name}}</b> </a> </p> <p> <?php $related_table = App\Field::find($relation->pivot->to_field_id)->table()->first(); ?> {{-- {{dd(AppField::find($relation->pivot->from_field_id)->table_id)}} --}} <a href="{{route('admin.devis.{devis}.admin.table.edit', [$devis->id, $related_table->id])}}" ><h4{{$related_table->name }}</h4> </a> {{-- {{dd($related_table->fields)}} --}} <ul> @forelse($related_table->fields as $related_table) <li>{{$related_table->id}} - {{$related_table->name}}</li> @empty No fields yet @endforelse </ul> </p>
return App\Status::whereSlug($slug)->first(); }); Route::bind('owner', function ($slug) { return App\Owner::whereSlug($slug)->first(); }); Route::bind('user', function ($id) { return App\User::find($id); }); Route::bind('note', function ($id) { return App\Note::find($id); }); Route::bind('information', function ($id) { return App\Information::find($id); }); Route::bind('field', function ($id) { return App\Field::find($id); }); Route::bind('activity', function ($id) { return App\Activity::find($id); }); # ROUTE RESOURCE # CATEGORY RESOURCE Route::resource('category', 'CategoryController'); Route::get('change_password', ['as' => 'change_password', 'uses' => 'UserController@viewChangePassword']); // GET get('{category_slug}/category_history', ['as' => 'c_h', 'uses' => 'CategoryController@categoryHistory']); get('{category_slug}/associate-dissociate-history', ['as' => 'ch', 'uses' => 'CategoryController@viewCategoryHistory']); get('{category_slug}/statuses', ['as' => 'sh', 'uses' => 'CategoryController@viewCategoryStatusesHistory']); get('{category_slug}/statuses_history', ['as' => 'c_s_h', 'uses' => 'CategoryController@categoryStatusHistory']); get('fetch/devices/{info_id}/{category_id}', ['as' => 'f_d_i', 'uses' => 'CategoryController@fetch_devices_infoValue']); get('fetch/category/{category_slug}', ['as' => 'f_c_cs', 'uses' => 'CategoryController@fetchCatName']);
function hasFields($args = array(), $options = array(), $extra_fields = false) { $fields = App\Field::select('id', 'cat_id', 'value', 'trans', 'tag', 'type')->whereIn('cat_id', $args)->get(); $output = ''; $edit_values = $extra_fields != false ? $extra_fields : ''; if (count($fields) > 0) { foreach ($fields as $field) { if (count($options) > 0) { if ($options[$field->tag]['col-sm']) { $col_sm = 'col-sm-' . $options[$field->tag]['col-sm']; } else { $col_sm = 'col-sm-4'; } } $output .= '<div class="row"><div class="' . $col_sm . '"><div class="form-group">'; $output .= Form::label('extra_fields[' . $field->trans . ']', trans('ex.' . $field->trans)); $values = get_fields($field->value); $val = empty($edit_values) ? '' : (!isset($edit_values[$field->trans]) ? '' : $edit_values[$field->trans]); switch ($field->tag) { case 'textarea': $output .= Form::textarea('extra_fields[' . $field->trans . ']', $val, ['class' => 'form-control']); break; case 'select': if (count($values) > 0) { $output .= Form::select('extra_fields[' . $field->trans . ']', array_two_field($values), $val, ['class' => 'form-control top0']); } break; default: switch ($field->type) { case 'checkbox': $output .= '<div class="check-boxes">'; if (count($values) > 0) { for ($i = 0; $i < count($values['trans']); $i++) { $v = isset($val->{$values}['trans'][$i]) && $val->{$values}['trans'][$i] == $values['val'][$i] ? 1 : null; $output .= '<label class="checkbox-inline">' . Form::checkbox('extra_fields[' . $field->trans . '][' . $values['trans'][$i] . ']', $values['val'][$i], $v) . ' ' . trans('ex.' . $values['trans'][$i]) . '</label> '; } } $output .= '</div>'; break; case 'radio': $output .= '<div class="radio-buttons">'; if (count($values) > 0) { for ($i = 0; $i < count($values['trans']); $i++) { $v = $val == $values['val'][$i] ? 1 : null; $output .= '<label class="checkbox-inline">' . Form::radio('extra_fields[' . $field->trans . ']', $values['val'][$i], $v) . ' ' . trans('ex.' . $values['trans'][$i]) . '</label> '; } } $output .= '</div>'; break; default: $output .= Form::text('extra_fields[' . $field->trans . ']', $val, ['class' => 'form-control']); break; } break; } $output .= '</div></div></div>'; } } return $output; }