<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: steven</title>
    <description>The latest articles on DEV Community by steven (@steven595804).</description>
    <link>https://dev.to/steven595804</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F832664%2F1ad7185b-ec9e-41b8-9e91-f355744300a9.jpg</url>
      <title>DEV Community: steven</title>
      <link>https://dev.to/steven595804</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/steven595804"/>
    <language>en</language>
    <item>
      <title>block user days doesn't work</title>
      <dc:creator>steven</dc:creator>
      <pubDate>Fri, 20 May 2022 09:31:48 +0000</pubDate>
      <link>https://dev.to/steven595804/block-user-days-doesnt-work-7bf</link>
      <guid>https://dev.to/steven595804/block-user-days-doesnt-work-7bf</guid>
      <description>&lt;p&gt;Hi amazing people,&lt;/p&gt;

&lt;p&gt;i had a question. i got a message that the days doesn't work for my login page. does somebody know what is wrong.&lt;/p&gt;

&lt;p&gt;i will upload my code also here!&lt;br&gt;
&amp;lt;?php&lt;/p&gt;

&lt;p&gt;namespace App\Http\Middleware;&lt;/p&gt;

&lt;p&gt;use Closure;&lt;br&gt;
use Illuminate\Http\RedirectResponse;&lt;br&gt;
use Illuminate\Http\Request;&lt;br&gt;
use Illuminate\Http\Response;&lt;/p&gt;

&lt;p&gt;class CheckBanned&lt;br&gt;
{&lt;br&gt;
    /**&lt;br&gt;
     * Handle an incoming request.&lt;br&gt;
     *&lt;br&gt;
     * &lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt; Request $request&lt;br&gt;
     * &lt;a class="mentioned-user" href="https://dev.to/param"&gt;@param&lt;/a&gt; Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next&lt;br&gt;
     * @return Response|RedirectResponse&lt;br&gt;
     */&lt;br&gt;
    public function handle($request, Closure $next)&lt;br&gt;
    {&lt;br&gt;
        if (auth()-&amp;gt;check() &amp;amp;&amp;amp; auth()-&amp;gt;user()-&amp;gt;banned_until &amp;amp;&amp;amp; now()-&amp;gt;lessThan(auth()-&amp;gt;user()-&amp;gt;banned_until)) {&lt;br&gt;
            $banned_days = now()-&amp;gt;diffInDays(auth()-&amp;gt;user()-&amp;gt;banned_until);&lt;br&gt;
            auth()-&amp;gt;guard('web')-&amp;gt;logout();&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        if ($banned_days &amp;gt; 14) {
            $message = 'Your account has been suspended ,Please contact administrator.';
        } else {
            $message = 'Your account has been suspended for '.$banned_days . $this-&amp;gt;str_plural('days', $banned_days) .'. Please contact administrator.';
        }

        return redirect()-&amp;gt;route('login')-&amp;gt;withMessage($message);
    }

    return $next($request);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;this is the error Your account has been suspended for 2. Please contact administrator.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>help</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
