当前位置: 首页>>代码示例>>PHP>>正文


PHP DataForm::create方法代码示例

本文整理汇总了PHP中DataForm::create方法的典型用法代码示例。如果您正苦于以下问题:PHP DataForm::create方法的具体用法?PHP DataForm::create怎么用?PHP DataForm::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataForm的用法示例。


在下文中一共展示了DataForm::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getVehicle

 public function getVehicle($id)
 {
     if (Auth::user()->isAdmin()) {
         $device = Device::find($id);
         $vehicles = Vehicle::whereHas('Account', function ($query) {
             $query->where('company_id', Auth::user()->company_id);
         })->doesntHave('Device')->get()->lists("fullname", "id")->all();
         $form = \DataForm::create();
         $form->add('device_id', '', 'hidden')->insertValue($id);
         $form->add('device_name', 'Aparelho', 'text')->insertValue($device->name)->mode('readonly');
         $form->link('/devices', 'Voltar', 'TR');
         if ($device->vehicle_id != '') {
             $form->add('vehicle_name', 'Veículo', 'text')->insertValue($device->Vehicle->fullname)->mode('readonly');
             $form->add('vehicle_id', '', 'hidden')->insertValue($device->vehicle_id);
             $form->add('install_date', 'Data de Instalação', 'date')->format('d/m/Y')->insertValue($device->install_date)->mode('readonly');
             $form->textarea('description', 'Observações')->insertValue($device->description)->mode('readonly');
             $form->add('action', '', 'hidden')->insertValue('remove');
             $form->label('Remover Aparelho');
             $form->submit('Confirma Retirada');
         } else {
             $form->add('vehicle_id', 'Veículo', 'select')->option("", "Selecione")->options($vehicles)->rule('required');
             $form->add('install_date', 'Data de Instalação', 'date')->format('d/m/Y')->rule('required');
             $form->textarea('description', 'Observações')->rule('required|min:15');
             $form->add('action', '', 'hidden')->insertValue('assign');
             $form->label('Instalar Aparelho');
             $form->submit('Salvar');
         }
         return $form->view('devices::vehicle', compact('form'));
     } else {
         return $form->view('errors.503');
     }
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:32,代码来源:DevicesController.php

示例2: getArguments

 public function getArguments(Request $request)
 {
     $device_id = $request->device_id;
     $device = Device::find($device_id);
     $id_command = $request->id_command;
     $names = config('commands_names');
     $template = config('commands_syntax.' . $id_command);
     $form = \DataForm::create();
     $form->add('device_id', '', 'hidden')->insertValue($device_id);
     $form->add('device_name', 'Aparelho', 'text')->insertValue($device->serial)->mode('readonly');
     $form->add('type', '', 'hidden')->insertValue(array_get($template, 'TYPE'));
     $form->link("/commands/send/{$device_id}", 'Voltar', 'TR')->back();
     $form->label($names[$id_command]);
     $params = array_get($template, 'PARAMETERS');
     $p = 0;
     foreach ($params as $param) {
         $form->add('PAR_' . $p, '', 'hidden')->insertValue($param['ID']);
         if ($param['VALUE'] !== '') {
             if (is_array($param['VALUE'])) {
                 $form->add('VAL_' . $p, $param['LABEL'], 'select')->options($param['VALUE']);
             } else {
                 $form->add('VAL_' . $p, '', 'hidden')->insertValue($param['VALUE']);
             }
         } else {
             $form->add('VAL_' . $p, $param['LABEL'], 'text');
         }
         $p++;
     }
     $form->add('param_count', '', 'hidden')->insertValue($p);
     //dd($template);
     $form->submit('Salvar');
     return $form->view('commands::edit', compact('form'));
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:33,代码来源:CommandsController.php

示例3: getpassword

 public function getpassword()
 {
     $form = \DataForm::create();
     $form->add('user_id', '', 'hidden')->insertValue(Auth::user()->id);
     $form->add('old_password', 'Senha Antiga', 'password');
     $form->add('password', 'Senha Nova', 'password');
     $form->add('password_confirmation', 'Confirme a Senha', 'password');
     $form->label('Alterar Senha');
     $form->submit('Atualizar');
     $form->build();
     return $form->view('user.password', compact('form'));
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:12,代码来源:UserController.php


注:本文中的DataForm::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。