PHP code example of peterzaccha / dy-form
1. Go to this page and download the library: Download peterzaccha/dy-form library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
peterzaccha / dy-form example snippets
// config/app.php
'providers' => [
...
Peterzaccha\DyForm\DyFormServiceProvider::class
];
$form = Dy::create(['name'=>'myForm']);
$column = Dy::createColumn(['name'=>'myColumn','label'=>'My Column','render_type'=>'text']);
Dy::addColumn($form,$column);
Dy::addOption($column,Dy::createOption(['name'=>'one','value'=>'1']));
Dy::submit($user, \Peterzaccha\DyForm\Models\DyForm::find(1),[
'columnName' => 'column value',
]);
//or from request
Dy::submit($user, \Peterzaccha\DyForm\Models\DyForm::find(1),$request->all());
namespace App;
use Peterzaccha\DyForm\Traits\CanSubmit;
class User extends Authenticatable
{
use CanSubmit;
}
use Peterzaccha\DyForm\Models\DyColumn;
$column = DyColumn::find(1);
$user->getColumnValue($column);
//return the user submitted value in that column
use Peterzaccha\DyForm\Models\DyForm;
$form = DyForm::find(1);
$user->getFormValues($form);
//return [ 'colum1'=>'value1' , 'column2'=>'value2' ]
bash
php artisan vendor:publish --provider="Peterzaccha\DyForm\DyFormServiceProvider"
php artisan migrate