未定义的变量:数据(视图:C:\ xampp \ htdocs \ lsapp \ resources \ views \ complete.blade.php)

时间:2018-09-17 10:24:51

标签: laravel-5

我有一个名为simpleController的控制器,这是代码

use Illuminate\Support\Facades\Redirect;


class simpleController extends Controller {

public function complete() {
    $all_registration_info=DB::table('registration')->get();
    if (count($all_registration_info) > 0) {
        return view('complete',$all_registration_info);
    }else{
        return view('index');
    }
}
}

然后有一个名为complete.blade.php的类,这里是代码

<tbody>
    @foreach( $data as $value)
    <tr>
        <th scope="row">{{$value->id}}</th>
        <td>{{$value->name}}</td>
        <td>{{$value->email}}</td>
        <td>{{$value->phone}}</td>
        <td>{{$value->password}}</td>
        <td>
            <a href="" class="btn btn-info">Edit</a>
            <a href="" class="btn btn-danger">Delete</a>
        </td>
    </tr>
    @endforeach
</tbody>

0 个答案:

没有答案