调用未定义的方法 onlyTrashed()
Call to undefined method onlyTrashed()
谁能帮帮我?
如何解决 ->
BadMethodCallException
Call to undefined method App\ModalName::onlyTrashed()
我的控制器 ->
public function destroy(Abc $abc)
{
$abc= Abc::destroy($abc->id)->get();
return redirect('/dir/abcdir')-> with('delete', 'aaa');
}
根据文档,您需要使用特征 'SoftDeletes'。
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Flight extends Model
{
use SoftDeletes;
}
PS:
请post完成您的控制器和型号的代码。
让 SoftDelete 在 Laravel Eloquent 模型
中工作
- 您必须使用
SoftDeletes
特质
- Table 架构应具有
$table->softDeletes();
,这将在 table 中添加 deleted_at
列。
谁能帮帮我?
如何解决 ->
BadMethodCallException
Call to undefined method App\ModalName::onlyTrashed()
我的控制器 ->
public function destroy(Abc $abc)
{
$abc= Abc::destroy($abc->id)->get();
return redirect('/dir/abcdir')-> with('delete', 'aaa');
}
根据文档,您需要使用特征 'SoftDeletes'。
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Flight extends Model
{
use SoftDeletes;
}
PS: 请post完成您的控制器和型号的代码。
让 SoftDelete 在 Laravel Eloquent 模型
中工作- 您必须使用
SoftDeletes
特质 - Table 架构应具有
$table->softDeletes();
,这将在 table 中添加deleted_at
列。