Testing.php第39行中的fatalthrowable错误:Class';App\TestingModel';未找到laravel 5.3

Testing.php第39行中的fatalthrowable错误:Class';App\TestingModel';未找到laravel 5.3,php,laravel-5.3,Php,Laravel 5.3,我对Laravel 5.3和学习是新手。现在我已经创建了表单,我想通过控制器和模型将表单值插入数据库。现在我将所有数据从表单获取到控制器,并想将其传递到模型。但当我将数据传递到模型时,我得到一个错误 "BadMethodCallException in Controller.php line 82: Method [savemodel] does not exist" 这是我的查看页面代码: {{Form::open(array('action' => 'Testing@store',

我对Laravel 5.3和学习是新手。现在我已经创建了表单,我想通过控制器和模型将表单值插入数据库。现在我将所有数据从表单获取到控制器,并想将其传递到模型。但当我将数据传递到模型时,我得到一个错误

"BadMethodCallException in Controller.php line 82:
Method [savemodel] does not exist" 
这是我的查看页面代码:

{{Form::open(array('action' => 'Testing@store', 'method' => 'post'))}}

<div class="form-group">
    {!! Form::label('title', 'Title:', ['class' => 'control-label']) !!}
    {!! Form::text('title', null, ['class' => 'form-control']) !!}
</div>

<div class="form-group">
    {!! Form::label('description', 'Description:', ['class' => 'control-label']) !!}
    {!! Form::textarea('description', null, ['class' => 'form-control']) !!}
</div>

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

{!! Form::close() !!}
{{Form::open(数组('action'=>)Testing@store“,”方法“=>”post'))}
{!!Form::label('title','title:',['class'=>'controllabel'])
{!!Form::text('title',null,['class'=>'Form control'])
{!!Form::label('description','description:',['class'=>'controllabel'])
{!!Form::textarea('description',null,['class'=>'Form control'])
{!!Form::submit('Submitform',['class'=>'btn-btn-primary'])
{!!Form::close()!!}
这是我的控制器(Testing.php):

这是我的模态

`


首先,在控制器中为模型添加名称空间

use App\TestingModel
那么你的控制器功能是这样的

public function store(Request $request)
{
    //echo 'hi';
  $storeform=new TestingModel;
  $storeform->title = $request->input('title');
  $storeform->description = $request->input('description');
  $storeform->save();
 }
$table = 'table_name';
$fillable = [ 'title', 'description' ];
$storeform = TestingModel::savemodel();
然后像这样编辑你的模型

public function store(Request $request)
{
    //echo 'hi';
  $storeform=new TestingModel;
  $storeform->title = $request->input('title');
  $storeform->description = $request->input('description');
  $storeform->save();
 }
$table = 'table_name';
$fillable = [ 'title', 'description' ];
$storeform = TestingModel::savemodel();
如果您想从模型中运行函数,那么编写如下代码

public function store(Request $request)
{
    //echo 'hi';
  $storeform=new TestingModel;
  $storeform->title = $request->input('title');
  $storeform->description = $request->input('description');
  $storeform->save();
 }
$table = 'table_name';
$fillable = [ 'title', 'description' ];
$storeform = TestingModel::savemodel();