Empty Line Problem - Laravel

Asked

Viewed 34 times

0

I have a problem, I have a few months of experience in Laravel and I did not see this kind of problem happen, when submitting a form appears the following error:

Error Exception Trying to get property of non-object in LivroController.php (line 206)

An error like this I have seen several times, however when going to the file and line specified I realize that in the line there is nothing.

LivroController.php

if($aluno->StatusAluno == 1)
{
        //Se o aluno já tenha um livro, ele retorna a mensagem
       Session::flash('mensagemError','O aluno já tem um livro emprestado');
       return redirect()
                 ->action('MainController@index');
}
else
{
     //esta é a linha 206, este comentário não existe no código

     //------------Fim da verificação do Aluno-------------- 

     //------------Verificação do Livro --------------

     if($l->is_disp == 0) { ...

have already given php artisan config:clear in the cmd and nothing has changed.

  • you better put the Controller complete and also the error! so is very vague.!

  • the problem is that this is a very large method(about 170 lines)

  • is a local error, it is complicated to evaluate and say your problem!

  • you can use isset before checking student status, isset($aluno->StatusAluno) && $aluno->StatusAluno == 1

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.