how to use return with url function in Laravel

I want to redirect the same page when error occurs.
so i want to use return with url .
is that possible ?

 <?php
                    if(DB::connection()->getDatabaseName()==null){
                        session()->put('error', 'your .env file has error');
                        ?><a href="{{url('installer')}}">home</a>
                        <?php
                        return url('installer');
                    }?>