我正在使用这个库:https ://www.laravelplay.com/packages/ycs77::laravel-wizard
我完成了所有步骤并得到了与示例中相同的结果。
我试图从数据库中获取数据到每个步骤。
型号(App/steps/intro/DropboxStep.php):
<?php
namespace App\Steps\Intro;
use Illuminate\Http\Request;
use Ycs77\LaravelWizard\Step;
use DB;
class DropboxStep extends Step
{
/**
* The step slug.
*
* @var string
*/
protected $slug = 'dropbox';
/**
* The step show label text.
*
* @var string
*/
protected $label = 'Dropbox';
/**
* The step form view path.
*
* @var string
*/
protected $view = 'steps.intro.dropbox';
/**
* Set the step model instance or the relationships instance.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation|null
*/
public function model(Request $request)
{
//
}
/**
* Save this step form data.
*
* @param \Illuminate\Http\Request $request
* @param array|null $data
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation|null $model
* @return void
*/
public function saveData(Request $request, $data = null, $model = null)
{
//
}
/**
* Validation rules.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function rules(Request $request)
{
return [];
}
public function getOptions()
{
$stepa2 = DB::table('tutorials')->where('id', '2')->first();
return [
'stepa2' => $stepa2,
'Lucas',
];
}
}
看法:
<div class="form-group">
{{ $stepa2 }}
</div>
结果:未定义的变量:stepa2
也通过控制器尝试过(IntroWizardController.php)
www说