Thursday, March 9, 2017

htmlentities() expects parameter 1 to be string, array given help please

Hello everyone this is my first post on stack overflow. I have solved a lot of problems thanks to this community.

My problem seems to be with laravel helpers. Everything was working fine until I change some files to other folders, off course I changed the routes and on routes and controllers but now I'm getting this message:

ErrorException in HtmlBuilder.php line 65: htmlentities() expects parameter 1 to be string, array given (View: /Library/WebServer/Documents/gamstec/resources/views/posts/create.blade.php)

This is my create file:

<div class="content">
    <div class="container-fluid">
        <div class="row well bs-component">
            <div class="col-md-8 col-md-offset">
            <div class="input-group">

                <h3 class="text-center">Crear Nueva Publicación</h3>
                <hr>

                {!! Form::open(array('route' => 'posts.store', 'data-parsley-validate' => '')) !!}

                    

                    

                    

                    

                    


                </div>
            </div> <!-- col-md-8 end -->


            <div class="col-md-4">
            <div class="input-group">
                <h3 class="text-center">Categoría e imágen</h3>
                <hr>


                     <br> <hr>

                    

                    
                    <br> <hr>

                     
                    <br> <br>
                    

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

            </div> <!-- item-group end -->
            </div> <!-- col-md-4 end -->


        </div> <!-- end of row -->
    </div> <!-- end of container -->
</div> <!-- end of content -->

This is my controller file:

<?php


public function index()
{
    return view('admin');
}

/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create()
{
    return view('posts.create');
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    // validate the data
    $this->validate($request, array(
        'title' => 'required|max:255',
        'body' => 'required',
        ));

    // store in database
    $post = new Post;

    $post->title = $request->title;
    $post->body = $request->body;
    $post->badge = $request->badge;
    $post->postimg = $request->postimg;

    $post->save();

    Session::flash('success', 'La publicación se ha creado correctamente');

    // redirect to another page
    return redirect()->route('show', $post->id);
}

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function show($id)
{
    $post = Post::find($id);
    return view('show')->withPost($post);
}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function edit($id)
{
    //
}

/**
 * Update the specified resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function update(Request $request, $id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function destroy($id)
{
    //
}

I'll be grateful for your help.



via Juan Rincón

Advertisement