Form submission and receipt on the same page (Laravel, php, blade)

I don’t understand why this doesn’t work. Help!!!
I need the entered value to be displayed in input after sending.

TestController.php

class TestController extends Controller {

public function form(Request $request) {
    if ($request->isMethod('get')) {
        echo 'REQUEST GET';                      
        return view('test');  
    }
    
    if ($request->isMethod('post')) {
        $text = $request->input('text');
        echo 'REQUEST POST';
        echo '<br>';
        echo $text;  
        return view('test', ('text', $text));
    }
}

}

test.blade.php

<div class="container">
<div class="col-sm-offset-0 col-sm-12 {{ $CONTAINER_SETTINGS->OFFSET_MD }} {{ $CONTAINER_SETTINGS->WIDTH_MD }}">
    <div class="panel panel-default">
        <div id="header" class="panel-heading">
            <h4><i class="fa fa-btn fa-users"></i>Test</h4>
        </div>

        <div class="panel-body">

            <form action="{{ url('test') }}" method="POST">
                {{ csrf_field() }}
                @if(isset($text))
                <input type="text" name="text" value="{{ $text }}">                                      
                @else
                <input type="text" name="text" >                                      
                @endif
                <input type="submit">
            </form>
        </div>
    </div>
</div>

web.php (routes)

Route::get('test', 'TestController@form');
Route::post('test', 'TestController@form');

enter image description here

enter image description here