<?php

if (!function_exists('form_text')) {
    function form_text($name, $value = null, $attributes = [])
    {
        $attr = '';
        foreach ($attributes as $key => $val) {
            $attr .= $key . '="' . $val . '" ';
        }

        $value = old($name, $value);

        return '<input type="text" name="'.$name.'" value="'.$value.'" '.$attr.'>';
    }
}

if (!function_exists('form_password')) {
    function form_password($name, $attributes = [])
    {
        $attr = '';
        foreach ($attributes as $key => $val) {
            $attr .= $key . '="' . $val . '" ';
        }

        return '<input type="password" name="'.$name.'" '.$attr.'>';
    }
}

if (!function_exists('form_email')) {
    function form_email($name, $value = null, $attributes = [])
    {
        $attr = '';
        foreach ($attributes as $key => $val) {
            $attr .= $key . '="' . $val . '" ';
        }

        $value = old($name, $value);

        return '<input type="email" name="'.$name.'" value="'.$value.'" '.$attr.'>';
    }
}