Ejemplo n.º 1
0
     });
     $validator->check('key')->is_max(1, __('extend.key_missing'))->is_valid_key(__('extend.key_exists'));
     $validator->check('label')->is_max(1, __('extend.label_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/extend/fields/add');
     }
     if ($input['field'] == 'image') {
         $attributes = Json::encode($input['attributes']);
     } elseif ($input['field'] == 'file') {
         $attributes = Json::encode(array('attributes' => array('type' => $input['attributes']['type'])));
     } else {
         $attributes = '';
     }
     Extend::create(array('type' => $input['type'], 'pagetype' => $input['pagetype'], 'field' => $input['field'], 'key' => $input['key'], 'label' => $input['label'], 'attributes' => $attributes));
     Notify::success(__('extend.field_created'));
     return Response::redirect('admin/extend/fields');
 });
 /*
     Edit Field
 */
 Route::get('admin/extend/fields/edit/(:num)', function ($id) {
     $vars['token'] = Csrf::token();
     $vars['types'] = Extend::$types;
     $vars['fields'] = Extend::$field_types;
     $extend = Extend::find($id);
     if ($extend->attributes) {
         $extend->attributes = Json::decode($extend->attributes);
     }
     $vars['field'] = $extend;