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

1

This is my first post and I hope you help me and be able to help many of you in the same way. As you saw in the title, it generates that error, and that happens to me now that I'm learning Laravel 5.1

This is the error

  

htmlentities () expects parameter 1 to be string, given array (View: C: \ xampp \ htdocs \ blog_laravel \ resources \ views \ movie \ create.blade.php)

My codes are as follows.

MovieController

<?php

namespace cinema\Http\Controllers;



use Illuminate\Http\Request;
use cinema\Http\Requests;
use cinema\Http\Controllers\Controller;
use cinema\Genre;
use cinema\Movie;

class MovieController extends Controller{

public function index(){
    //
}



public function create(){
    $genres = Genre::lists('genre','id');
    return view('pelicula.create',compact('genres'));
}

public function store(Request $request){
    Movie::create($request->all());
    return "Listo";
}

create.blade.php

@extends('layout.admin')

@section('content')
@include('alertas.ErroresFormulario')

{!!Form::open(['route'=>'pelicula.store', 'method'=>'POST','files'=>  true])!!}
    @include('pelicula.forms.crearPelicula')
    {!!Form::submit(['Registrar','class' => 'btn btn-primary'])!!}
{!!Form::close()!!}

@endsection

This is my createPelicula.blade.php

<div class="form-group">
{!!Form::label('nombre','Nombre:')!!}
{!!Form::text('name',null,['class'=>'form-control','placeholder'=>'Ingrese  Nombre de la pelicula'])!!}
</div>
<div class="form-group">
{!!Form::label('elenco','Elenco:')!!}
{!!Form::text('cast',null,['class'=>'form-control','placeholder'=>'Ingrese   el elenco'])!!}
</div>
<div class="form-group">
{!!Form::label('direccion','Dirección:')!!}
{!!Form::text('direction',null,['class'=>'form-control','placeholder'=>'Ingrese el Director'])!!}
</div>
<div class="form-group">
{!!Form::label('duracion','Duración:')!!}
{!!Form::text('duration',null,['class'=>'form-control','placeholder'=>'Duración de la pelicula'])!!}
</div>
<div class="form-group">
{!!Form::label('Poster','Poster:')!!}
{!!Form::file('path')!!}
</div>
<div class="form-group">
{!!Form::label('Genero','Genero:')!!}
{!!Form::select('genre_id',$genres)!!}
</div>
    
asked by Luis Morales 20.09.2016 в 05:41
source

1 answer

1

You are passing an array as the first parameter in the submit of the form, when it should be a string:

{!! Form::submit('Registrar', ['class' => 'btn btn-primary']) !!}

The second parameter is the array of options.

I leave as a reference the LaravelCollective code that refers to the submit button:

/**
 * Create a submit button element.
 *
 * @param  string $value
 * @param  array  $options
 *
 * @return \Illuminate\Support\HtmlString
 */
public function submit($value = null, $options = [])
{
    return $this->input('submit', null, $value, $options);
}
    
answered by 20.09.2016 / 06:07
source