dimanche 20 mars 2016

Laravel not saving textarea value in the db

I can't really figure uot what is wrong why this code is not saving textarea value. every other things are working fine, except the saving of textarea content. If I remove the textarea code it saves successfully. This is the the controller action: Please help out. Thanks.

public function store(CompanyRequest $companyRequest)
    {
       $company = new Company;

       if($companyRequest->isMethod('post')){

       $company->companyname    = $companyRequest->companyname;
       $company->companydescription    = $companyRequest->companydescription;

       $company->save();
       return redirect()->route('companyindex')->with('message', 'Your question has been posted.');
       }else{
            return redirect('company-create')->withErrors($companyRequest)->withInput();
        }
    }

This is the blade view:

{!! Form::textarea('companydescription', Input::old('companydescription'), ['class'=>'mid first-input-div', 'id'=>'companydescription']) !!}

This is the request file;

class CompanyRequest extends Request
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
                'companyname'           => 'required|min:5|max:300',
                'companydescription'    => 'required|min:200|max:250'
            ];
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire