2

Algo falla en el registro de nuevos usuarios. introducir la descripción de la imagen aquí

Aqui tengo un intento de crear usuario en el que he puesto mal la confirmación de la contraseña. Eso deberia devolverme al creador de nuevo usuario con un mensaje en rojo indicando mi error. Pero en vez de eso me veo con este mensaje: introducir la descripción de la imagen aquí

Por el contrario si los datos estan correctos consigo iniciar sesión correctamente.

Aqui esta el código php de la vista:

@extends('layouts.app')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Nuevo usuario</div>

                <div class="panel-body">
                    <form class="form-horizontal" method="POST" action="{{ route('register') }}">
                        {{ csrf_field() }}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label for="name" class="col-md-4 control-label">Nombre</label>

                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label for="email" class="col-md-4 control-label">Correo electronico</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label for="password" class="col-md-4 control-label">Contraseña (mínimo seis caracteres)</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="password-confirm" class="col-md-4 control-label">Confirmar Contraseña</label>

                            <div class="col-md-6">
                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    Registrarse
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

Edito: No se si servira de algo, pero he encontrado un fichero llamado RegisterController.php:

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users',
            'password' => 'required|string|min:6|confirmed',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}

A ver si esto sirve de ayuda para descubrir donde esta el fallo.

Tambien voy a dejar varios datos sobre la tabla User por si termina sirviendo para ver donde esta el error.

User.php:

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable{
    use Notifiable;

    protected $fillable = [
        'name', 'email', 'password', 'saldo', 'papel',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

    public function comentarios(){
        return $this->hasMany(Comentario::class,'miembro');
    }

    public function tickets(){
        return $this->hasMany(Entrada::class,'persona');
    }
}

create_users_table.php:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration{
    public function up(){
        Schema::create('users', function (Blueprint $table){
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

        Schema::table('users', function (Blueprint $table){
            $table->integer('saldo')->nullable();
            $table->string('rol')->nullable(); // Habra 2 opciones: Cliente o Administrador.
        });
    }

    public function down(){
        Schema::dropIfExists('users');
    }
}

UserController.php:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\plantas;
use App\User;
use App\Comentario;
use App\Entrada;
use Illuminate\Support\Facades\Auth;

class UserController extends Controller{
    public function formulario(){
        return view('formularios.saldo');
    }

    public function store(Request $request){
        $normas=[
            'saldo' => 'required',
        ];

        $this->validate($request,$normas);

        if(empty(Auth::user()->saldo))
            Auth::user()->saldo=$request->saldo;
        else    
            Auth::user()->saldo+=$request->saldo;
        Auth::user()->save();
        return redirect('/')->with('message', ['success', __("Su ingreso se ha efectuado con exito.")]);
    }

    public function elegir(){
        return view('formularios.rolificacion');
    }

    public function acto(Request $request){
        $normas=[
            'rol' => 'required',
        ];

        $this->validate($request,$normas);

        $d=$request->rol;

        if($d=="administrador" && (is_null($request->clave) || $request->clave!='BaSuReRo2014')){
            Auth::user()->rol='botones';
            Auth::user()->save();
            return redirect('/')->with('message', ['danger', __("¡VEAMOS SI TE RIES AHORA!")]);
        }
        else{
            Auth::user()->rol=$d;
            Auth::user()->save();
            return redirect('/')->with('message', ['success', __("Rol seleccionado correctamente.")]);
        }
    }

    public function cliente(){
        $cliente=User::paginate(5);
        return view('vegetal.cliente', compact('cliente'));
    }

    public function eliminado(User $cliente){
        $comentario=$cliente->comentarios()->with('usuario')->paginate(5);
        foreach($comentario as $com)
            Comentario::destroy($com->id);

        $entrada=$cliente->tickets()->with('cliente')->paginate(5);
        foreach($entrada as $ent)
            Entrada::destroy($ent->id);

        User::destroy($cliente->id);
        return back()->with('message', ['success', __("El cliente elegido ha sido eliminado.")]);
    }
}

Otra cosa, he probado a ir a .env y he puesto APP_DEBUG=false. Tras esto, he realizado varias pruebas en las que he provocado errores en diversos formularios y siempre terminan en este mensaje: introducir la descripción de la imagen aquí

Por ultimo, aqui esta app/Exceptions/Handler.php:

<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler{
    protected $dontReport = [
        //
    ];

    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    protected function toIlluminateResponse($response, Exception $e)
    {
        $response = new Response($response->getContent(), $response->getStatusCode(), $response->headers->all());

        $response->exception = $e;

        return $response;
    }

    protected function convertValidationExceptionToResponse(ValidationException $e, $request){
        $response = parent::convertValidationExceptionToResponse($e, $request);
        if ($response instanceof JsonResponse) {
            $original = $response->getOriginalContent();
            $original['message'] = __($original['message']);
            $response->setContent(json_encode($original));
        }
        return $response;
    }

    public function report(Exception $exception){
        parent::report($exception);
    }

        public function render($request, Exception $e){
        if (config('app.debug')) {
            $whoops = new \Whoops\Run;
            $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
            return response()->make(
                $whoops->handleException($e),
                method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500,
                method_exists($e, 'getHeaders') ? $e->getHeaders() : []
            );
        }
        return parent::convertExceptionToResponse($e);
    }
}

Edito: Ya he encontrado un ejemplo en laravel.logs. Es al introducir una planta por formulario dejando la variable comentario nulo.

[2018-02-23 14:22:43] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comentario' cannot be null (SQL: insert into `comentarios` (`planta`, `comentario`, `miembro`, `updated_at`, `created_at`) values (3, , 6, 2018-02-23 14:22:43, 2018-02-23 14:22:43)) {"userId":6,"email":"[email protected]","exception":"[object] (Illuminate\\Database\\QueryException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comentario' cannot be null (SQL: insert into `comentarios` (`planta`, `comentario`, `miembro`, `updated_at`, `created_at`) values (3, , 6, 2018-02-23 14:22:43, 2018-02-23 14:22:43)) at C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:664, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comentario' cannot be null at C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:458)
[stacktrace]
#0 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('insert into `co...', Array, Object(Closure))
#1 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(459): Illuminate\\Database\\Connection->run('insert into `co...', Array, Object(Closure))
#2 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(411): Illuminate\\Database\\Connection->statement('insert into `co...', Array)
#3 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Processors\\Processor.php(32): Illuminate\\Database\\Connection->insert('insert into `co...', Array)
#4 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php(2147): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into `co...', Array, 'id')
#5 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1281): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(722): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(687): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(550): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(753): Illuminate\\Database\\Eloquent\\Model->save()
#10 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\helpers.php(1038): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(App\\Comentario))
#11 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(754): tap(Object(App\\Comentario), Object(Closure))
#12 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1470): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1482): Illuminate\\Database\\Eloquent\\Model->__call('create', Array)
#14 C:\\xampp\\htdocs\\flora\\app\\Http\\Controllers\\ComentarioController.php(16): Illuminate\\Database\\Eloquent\\Model::__callStatic('create', Array)
#15 [internal function]: App\\Http\\Controllers\\ComentarioController->store(Object(Illuminate\\Http\\Request))
#16 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): call_user_func_array(Array, Array)
#17 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)
#18 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\ComentarioController), 'store')
#19 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(169): Illuminate\\Routing\\Route->runController()
#20 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(658): Illuminate\\Routing\\Route->run()
#21 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#22 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(67): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#38 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#39 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#40 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(660): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#42 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(635): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#43 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(601): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#44 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(590): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#45 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#46 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\xampp\\htdocs\\flora\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(65): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\xampp\\htdocs\\flora\\vendor\\fideloper\\proxy\\src\\TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#51 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#57 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#63 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#64 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#65 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#66 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#67 C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#68 C:\\xampp\\htdocs\\flora\\public\\index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#69 {main}
"} 
8
  • Muéstranos el código que realiza la validación, o el método del controlador que recibe los datos del formulario.
    – Shaz
    Commented el 22 feb. 2018 a las 21:27
  • @Shaz Es el metodo de registrar usuarios que incluye laravel (el que se crea escribiendo en la linea de comandos php artisan make:auth). No se cual debe ser su autentificador. Tambien le pasa al login. Commented el 23 feb. 2018 a las 7:57
  • @Shaz Aun así, he añadido información sobre la tabla User por si te sirve de algo. Commented el 23 feb. 2018 a las 8:11
  • 1
    Cuando creas que hay un error pero en principio no tienes un feedback del mismo revisa los logs en busca de información, directorio: storage/logs/
    – Orici
    Commented el 23 feb. 2018 a las 8:27
  • @Orici En la ruta que me has dicho he encontrado el fichero laravel.txt, el cual tiene un tocho de código que me cuesta entender. Aparte, he añadido más información. Commented el 23 feb. 2018 a las 11:08

2 respuestas 2

1

Laravel por defecto entrega excepciones cuando hay "cualquier" tipo de error, en este caso es un error de validación, a menos que se especifique lo contrario.

En este caso, en el archivo app/Exceptions/Handler.php tienes una propiedad protected utilizada para incluir los tipos de excepciones que no deberían generar respuestas o reportes:

protected $dontReport = [
    //
];

En todo proyecto normalmente se definen los tipos de excepciones que no desean reportarse, un ejemplo típico es este, basado en el mismo código de Laravel:

protected $dontReport = [
    AuthenticationException::class,
    AuthorizationException::class,
    HttpException::class,
    HttpResponseException::class,
    ModelNotFoundException::class,
    TokenMismatchException::class,
    ValidationException::class,
];

Ahí se puede ver el tipo de exception ValidationException, que es el que nos incumbe.

2
  • gracias a lo que has incluido no tengo problema al poner mal el correo del usuario, pero sigue fallando cuando tengo errores con la contraseña. Commented el 23 feb. 2018 a las 15:04
  • Bueno, pues déjame decirte que es el código que he empleado en proyectos gigantes de Laravel, con cientos de miles de usuarios, y ha funcionado sin problema, desde Laravel 5.1 hasta Laravel 5.6. Tal vez limpia el caché de tu navegador, o de Laravel, hay algo mal de tu lado. Si quieres entender un poco más sobre el reporte de excepciones, revisa: github.com/laravel/framework/blob/5.6/src/Illuminate/Foundation/…
    – Shaz
    Commented el 23 feb. 2018 a las 15:09
0

En respuesta a:

Edito: Ya he encontrado un ejemplo en laravel.logs. Es al introducir una planta por formulario dejando la variable comentario nulo.

y el error:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comentario' cannot be null (SQL: insert into `comentarios` (`planta`, `comentario`, `miembro`, `updated_at`, `created_at`) values (3, , 6, 2018-02-23 14:22:43, 2018-02-23 14:22:43)) {"userId":6,"email":"[email protected]","exception":"[object] (Illuminate\\Database\\QueryException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'comentario' cannot be null (SQL: insert into `comentarios` (`planta`, `comentario`, `miembro`, `updated_at`, `created_at`) values (3, , 6, 2018-02-23 14:22:43, 2018-02-23 14:22:43)) at C:\\xampp\\htdocs\\flora\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:664

Como aparece al principio del mensaje de error, se está violando una condición (o restricción) establecida en tu modelo de datos, no puedes crear/actualizar un registro de la tabla "comentarios" con un valor nulo para el campo "comentario", tienes que cargar un valor aceptable según el "diseño de la tabla". Aunque no veo que hayas puesto código relacionado en la pregunta deberías, la solución pasaría por comprobar la entrada, para que se cumpla esta condición antes de tratar de insertar/actualizar la BD, o tratar la situación de error en caso contrario, por ejemplo devolviendo al formulario de entrada de datos con un mensaje de feedback al usuario.

Saludos.

3
  • Para ese ejemplo he terminado haciendo este código: Commented el 23 feb. 2018 a las 22:06
  • public function store(Request $request){ if(is_null($request->nombre) || is_null($request->descripcion)) return back()->with('message', ['danger', __('El nombre y la descripcion son obligatorios')]); if(is_null($request->foto)) Plantas::create($request->all()); else Plantas::create(['id'=>$request->id, 'nombre'=>$request->nombre, 'tamaño'=>$request->tamaño, 'flor'=>$request->tamaño, 'hoja'=>$request->hoja, 'descripcion'=>$request->descripcion, 'foto'=>$request->foto->getClientOriginalName()]); return redirect('/')->with('message', ['success', __("Planta creada correctamente")]); } Commented el 23 feb. 2018 a las 22:07
  • Es algo chapuza, pero mejor eso que tener mi fallo. Commented el 23 feb. 2018 a las 22:07

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.