在 LARAVEL 中保存并显示来自外部网站的 POST 请求

Save and Display POST request from external website in LARAVEL

我正在处理来自外部网站的 POST 请求 我可以存储数据,但如何在 blade.

上显示它

控制器:

public function parse(Request $request)
    {
        $files = File::create([
            'Data1'      => $request->input('Data1'),
            'Data2'     => $request->input('Data2'),
            'Data3'       => $request->input('Data3'),
        ]);

        return view('fileview');
    }

路线:

Route::any('fileview', 'App\Http\Controllers\FilesController@Files')->name('parse');

Blade:

{{ $Data1 }}

编辑:

我从 returnURL 收到此错误,但数据存储完美

Trying to get property 'profile' of non-object (View: D:\Systems\final\resources\views\partials\dash-sidenav.blade.php) {"exception":"[object] (Facade\Ignition\Exceptions\ViewException(code: 0): Trying to get property 'profile' of non-object (View: D:\Systems\final\ esources\views\partials\dash-sidenav.blade.php) at D:\Systems\final\ esources\views/partials/dash-sidenav.blade.php:4)

dash-sidenav.blade.php

@if ((Auth::User()->profile) && Auth::user()->profile->avatar_status == 1)
                                <img src="{{ Auth::user()->profile->avatar }}" alt="{{ Auth::user()->name }}" class="user-avatar-nav">
                            @else
                            <img src="{{asset('images/mascot.jpg')}}" alt="" class="user-avatar-nav" >
                            @endif

请编辑您的控制器并像这样添加 ->with()

public function parse(Request $request)
{
    $files = File::create([
        'Data1'      => $request->input('Data1'),
        'Data2'     => $request->input('Data2'),
        'Data3'       => $request->input('Data3'),
    ]);

    return view('fileview')->with('Data1', $request->input('Data1'));
}