Home>

I would like to move to the LOGIN REGISTER screen on the upper right from the created site as below.
When I click on it, I get the following two errors: (Below the image)

htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/{user name}/Desktop/techpit-match/resources/views/auth/login.blade.php)

I am getting the error.

Among them, it says that there is an error on line 29.

login.blade.php
@extends('layouts.app')
@section('content')

    
        
            
                {{ __('Login') }}
                
                  <form method="POST" action="{{ route('login') }}">
                        @csrf
                        
                          <label for="email">{{ __('E-Mail Address') }}</label>
                            
                              <input type="email" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
                                @error('email')
                                  <span role="alert">
                                      <strong>{{ $message }}</strong>
                                  </span>
                                @enderror
                            
                        
                        
Line 29<label for="password">{{ __('Password') }}</label>
                            
                              <input type="password" name="password" required autocomplete="current-password">
                                @error('password')
                                  <span role="alert">
                                      <strong>{{ $message }}</strong>
                                  </span>
                                @enderror
                            
                        
                        
                            
                                
                                  <input type="checkbox" name="remember" {{ old('remember') ?'checked' :'' }}>
                                  <label for="remember">
                                        {{ __('Remember Me') }}
                                  </label>
                                
                            
                        
                        
                            
                              <button type="submit">
                                    {{ __('Login') }}
                              </button>
                                @if (Route::has('password.request'))
                                    
                                        {{ __('Forgot Your Password?') }}
                                    
                                @endif
                            
                        
                  </form>
                
            
        
    

@endsection

web.php
Route::get('/', function () {
    return view('welcome');
});
Auth::routes();
Route::get('/home','[email protected]')->name('home');

HomeController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        return view('home');
    }
}

I would appreciate if anyone could give me a solution.

  • Answer # 1

    I refer to variables such as $message in blade, but as long as I look at the controller, I have not passed anything to view.

    …But if it seems like you're stumbling here, you'll have to go one step further and step back three steps if you don't properly understand the basics of PHP before Laravel.

  • Answer # 2

    I can't see the contents of variables

    htmlspecialchars() expects parameter 1 to be string, array given

    It is a message that an array is being passed although a character string must be passed as an argument

    For the time being, let's check if there is an array in the variable used in login.blade.php
    If there is, let's expand it properly and use it to fix it.

  • Answer # 3

    It is solved.
    From the beginning, when installing Laravel/ui,

    $composer require laravel/ui "1.x" --dev

    I was able to solve the error by specifying the version as "1.x", preventing the latest version from being installed, and making it consistent with Laravel 6 like.