Nvd\Crud\Db::getSearchInputStr PHP Method

getSearchInputStr() public static method

public static getSearchInputStr ( $field )
    public static function getSearchInputStr($field)
    {
        // selects
        if ($field->type == 'enum') {
            $output = "{!!\\Nvd\\Crud\\Html::selectRequested(\n";
            $output .= "\t\t\t\t\t'" . $field->name . "',\n";
            $output .= "\t\t\t\t\t[ '', '" . join("', '", $field->enumValues) . "' ],\n";
            //Yes', 'No
            $output .= "\t\t\t\t\t['class'=>'form-control']\n";
            $output .= "\t\t\t\t)!!}";
            return $output;
        }
        // input type:
        $type = 'text';
        if ($field->type == 'date') {
            $type = $field->type;
        }
        $output = '<input type="' . $type . '" class="form-control" name="' . $field->name . '" value="{{Request::input("' . $field->name . '")}}">';
        return $output;
    }

Usage Example

Example #1
0
.index','<?php 
    echo ucwords(str_replace('_', ' ', $field->name));
    ?>
')!!}
			<?php 
}
?>
<th></th>
		</tr>
		<tr class="search-row">
			<form class="search-form">
				<?php 
foreach ($fields as $field) {
    ?>
<td><?php 
    echo \Nvd\Crud\Db::getSearchInputStr($field);
    ?>
</td>
				<?php 
}
?>
<td style="min-width: 6em;">@include('<?php 
echo $gen->templatesDir();
?>
.common.search-btn')</td>
			</form>
		</tr>
	    </thead>

	    <tbody>
	    	@forelse ( $records as $record )