I have this problem. When I create new Middleware and write this code
This is an error text syntax error, unexpected 'printf' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Http\Request;
class CheckTime
{
    printf("Right now is %s", Carbon::now()->toDateTimeString());
    // $now = Carbon::now();
    // $start = Carbon::createFromTimeString('00:00');
    // $end = Carbon::createFromTimeString('06:00');
    if ($now->between($start, $end)) {
        return redirect('/')->with('limitTime, You cant write post at this time');
    }
    return $next($request);
    public function handle(Request $request, Closure $next)
}
 
    