1

I am working on a project with Laravel 5.2 and was making a simple form, but I get the error:

Array to string conversion (View: C:\xampp\htdocs\projects\codehacking\resources\views\admin\posts\create.blade.php)

and this is my code:

@extends('layouts.admin')



@section('content')

    <h1>Create Post</h1>

    {!! Form::open(['method'=>'POST', 'action'=>'AdminPostsController@store', 'files'=>true]) !!}


        <div class="form-group">
          {!! Form::label('title', 'Title:') !!}
          {!! Form::text('title', null, ['class'=>'form-control'])!!}
        </div>

        <div class="form-group">
          {!! Form::label('category_id', 'Category:') !!}
          {!! Form::select('category_id', array(''=> 'options'), null, ['class'=>'form-control'])!!}
        </div>

        <div class="form-group">
          {!! Form::label('photo_id', 'Photo:') !!}
          {!! Form::file('photo_id', ['class'=>'form-control'])!!}
        </div>

        <div class="form-group">
          {!! Form::label('body', 'Description:') !!}
          {!! Form::textarea('body', ['class'=>'form-control'])!!}
        </div>

        <div class="form-group">
          {!! Form::submit('Create Post', ['class'=>'btn btn-primary'])!!}
        </div>   

    {!! Form::close() !!}

@stop

I thought the error might be with the select element, since in that element I am creating an array with options, but I was getting the same error even when I removed the element. Not sure what am I doing wrong?

1
  • 1
    Check the line in the complete error Commented May 11, 2017 at 12:59

1 Answer 1

2

Your error is on textarea

  {!! Form::textarea('body', null,  ['class'=>'form-control'])!!}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.