Laravel 的奇葩报错提示

Laravel 新手,大概使用 Laravel 不到 3 个月,也只是写了两个项目。使用过程之中,我发现 Laravel 的报错提示真的很奇葩。

#报错 1

Request Url:http://example.com/lamp/test

ERROR Report :
Whoops, looks like something went wrong.
1/1UnexpectedValueException
in Response.php line 399:The Response content must > be a string or object implementing __toString(), > "boolean" given. in Response.php line 399

Route.php
Route::post('lamp/test', 'Lamp\LampController@img');

Controller
Controller 里面就有 img 方法且是私有的,也有 test 方法。错误的地方是,在 routes.php 文件中,指定路由 “lamp/test” 对应的方法是 img。最终导致上面的错误。

#报错 2

ERROR Report:
2/2ReflectionException
in Route.php line 280:Class App\Http\Controllers\User\CustomerController does > not exist in Route.php line 280 at ReflectionMethod
->__construct('App\Http\Controllers\User\CustomerController', 'edit') >in Route.php line 280 ....

Conclution: controller 中的代码语法又问题,如下:

 $customer->salesmanName = $salesman->name ? $salesman->name ? $salesman->tel;

#报错 3

BadMethodCallException
in RedirectResponse.php line 211:Method [back] does not exist on Redirect.

Route.php

Route::get('back', 'BackController@index');

报错原因:

App\Http\Controllers 目录下,并没有 BackController。因为我创建 BackController 时,将文件错误地命名为 backController.php 了。

#报错 4

QueryException
in Connection.php line 769:SQLSTATE[HY000]: General error: 1364 Field 'type'
doesn't have a default value (SQL: insert into t_type (updated_at, created_at)
values (2016-11-08 08:19:04, 2016-11-08 08:19:04))

\App\Type.php

namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;
class Type extends Authenticatable {    
    //    use Notifiable, SoftDeletes;    
    protected $fillable = ['name']; // *报错引发的原因就是这里*
    protected $table = 't_type';    
    protected $dates = ['deleted_at'];
}

报错原因:如上代码注释。

#报错 4

QueryException
in Connection.php line 729:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'productId' in 'where clause' (SQL: delete from lamp_cart_detail where (cartId = 99 and productId = 37))

#报错 5

[Tue Mar 14 11:37:27 2017] [error] [client 119.136.115.138] PHP Fatal error:  Uncaught exception 
'Unexpected Value Exception' with message '. 
The stream or file "/home/www/default/blog/storage/logs/laravel.log" could not be opened: failed to open stream: 
Permission denied' in /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:
107\nStack trace:\n
#0/home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): 
Monolog\\Handler\\StreamHandler->write(Array)\n
#1 /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n
#2 /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Logger.php(616): 
Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n
#3 /home/www/default/blog/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203):
 Monolog\\Logger->error(Object(UnexpectedValueException), Array)\n
#4 /home/www/default/blog/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114):
 Illuminate\\Log\\Writer->writeLog('error', Object(Unexpected in/home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
[Tue Mar 14 11:37:27 2017] [error] [client 119.136.115.138] PHP Fatal error: 
 Uncaught exception 'Unexpected Value Exception' with message 'The stream or file "/home/www/default/blog/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in 
/home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\n
Stack trace:\n#0 /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/Abs                                                                                                                             tractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n
#1 /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n
#2 /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n
#3 /home/www/default/blog/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n
#4 /home/www/default/blog/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114):  in /home/www/default/blog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107

你可能感兴趣的:(Laravel 的奇葩报错提示)