<?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: Raziul Islam</title>
    <description>The latest articles on DEV Community by Raziul Islam (@raziul).</description>
    <link>https://dev.to/raziul</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%2F178667%2F7c3ad30f-c0cb-4648-9c1f-2cf6d79e6e00.jpg</url>
      <title>DEV Community: Raziul Islam</title>
      <link>https://dev.to/raziul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raziul"/>
    <language>en</language>
    <item>
      <title>Laravel 12 Release Date Announced</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Tue, 04 Feb 2025 16:24:11 +0000</pubDate>
      <link>https://dev.to/raziul/laravel-12-release-date-announced-49fm</link>
      <guid>https://dev.to/raziul/laravel-12-release-date-announced-49fm</guid>
      <description>&lt;h2&gt;
  
  
  Laravel 12 Release Date Announced: What You Need to Know
&lt;/h2&gt;

&lt;p&gt;The Laravel community is abuzz with excitement. Taylor Otwell announced the official release date for  &lt;strong&gt;Laravel 12&lt;/strong&gt;  at  &lt;strong&gt;&lt;em&gt;Laracon EU Amsterdam 2025:&lt;/em&gt;&lt;/strong&gt;   &lt;strong&gt;February 24th, 2025&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Laravel remains one of the most popular PHP frameworks for building modern web applications. With each new version, Laravel sets higher standards by adding performance improvements, new features, and better security. Let's explore what to expect from Laravel 12 and how to get ready for its release.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Highlights of Laravel 12
&lt;/h2&gt;

&lt;p&gt;While the full release notes will provide a detailed breakdown of changes, here are some of the most anticipated features and improvements rumored or confirmed for Laravel 12:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Performance Enhancements&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel has always prioritized speed and efficiency, and Laravel 12 is no exception. Expect significant optimizations in areas such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Routing mechanisms&lt;/li&gt;
&lt;li&gt;Caching strategies&lt;/li&gt;
&lt;li&gt;Database query handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These enhancements will ensure that your applications run faster and more efficiently than ever before.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Improved Developer Experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Developer happiness is at the core of Laravel’s philosophy, and Laravel 12 aims to take this to the next level. Some of the expected updates include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streamlined workflows for common tasks&lt;/li&gt;
&lt;li&gt;Enhanced debugging tools&lt;/li&gt;
&lt;li&gt;New CLI commands to simplify development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These additions will make coding with Laravel even more intuitive and enjoyable.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;New Features and APIs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel 12 is rumored to introduce several new features and APIs designed to address modern development challenges. Potential updates include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improvements to &lt;strong&gt;Eloquent ORM&lt;/strong&gt; for better database interactions&lt;/li&gt;
&lt;li&gt;Enhanced functionality in &lt;strong&gt;Blade templates&lt;/strong&gt; for more dynamic front-end rendering&lt;/li&gt;
&lt;li&gt;Updates to &lt;strong&gt;queues and jobs&lt;/strong&gt; for smoother background processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developers can also look forward to new tools that simplify integration with third-party services and APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Security Upgrades&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Security remains a top priority for the Laravel team. Laravel 12 will likely include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Additional safeguards against common vulnerabilities&lt;/li&gt;
&lt;li&gt;Updated best practices for secure authentication and authorization&lt;/li&gt;
&lt;li&gt;Enhanced encryption and hashing mechanisms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These updates will help developers build applications that are not only powerful but also secure.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Compatibility with Latest Technologies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel 12 will ensure seamless compatibility with the latest versions of PHP and other technologies in the PHP ecosystem. This means you can confidently upgrade your projects without worrying about breaking changes.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Will Laravel 12 Be Released?
&lt;/h2&gt;

&lt;p&gt;According to the official announcement,  &lt;strong&gt;Laravel 12&lt;/strong&gt;  will be released on  &lt;strong&gt;February 24th, 2025&lt;/strong&gt;. This timeline aligns with Laravel’s tradition of releasing major updates annually, typically in  &lt;strong&gt;Q1 of Each Year&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As with previous releases, Laravel 12 will follow the framework’s usual cadence of long-term support (LTS) and general releases. If you’re currently using an LTS version, now is a great time to start planning your migration strategy.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Prepare for Laravel 12
&lt;/h2&gt;

&lt;p&gt;To ensure a smooth transition to Laravel 12, here are a few steps you can take:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Update Dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ensure your current projects are running on the latest versions of Laravel and PHP. This will minimize compatibility issues when upgrading to Laravel 12.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Review the Upgrade Guide&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once the official upgrade guide is released, carefully review it to understand any breaking changes and migration steps. The Laravel team provides detailed documentation to make the upgrade process as seamless as possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Experiment with Beta Versions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you’re eager to get a head start, keep an eye out for beta releases. Testing the new features in a development environment will help you identify potential issues early and familiarize yourself with the changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Stay Informed&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Follow trusted sources like &lt;strong&gt;Laravel News&lt;/strong&gt; , the official &lt;strong&gt;Laravel blog&lt;/strong&gt; , and community forums to stay updated on the latest announcements, tutorials, and insights.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Laravel 12 Matters
&lt;/h2&gt;

&lt;p&gt;Laravel continues to set the standard for PHP frameworks by balancing innovation with stability. Laravel 12 promises to deliver a host of improvements that will empower developers to build faster, more secure, and more scalable applications. Whether you’re a seasoned Laravel developer or just getting started, this release is sure to bring value to your projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The release of Laravel 12 marks another milestone in the evolution of this beloved framework. With its focus on performance, developer experience, and security, Laravel 12 is poised to become an essential tool for modern web development.&lt;/p&gt;

&lt;p&gt;Are you excited about Laravel 12?&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>framework</category>
      <category>features</category>
    </item>
    <item>
      <title>Exploring PHP 8.4: Exciting New Features with Examples</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Fri, 06 Dec 2024 12:54:41 +0000</pubDate>
      <link>https://dev.to/raziul/exploring-php-84-exciting-new-features-with-examples-515h</link>
      <guid>https://dev.to/raziul/exploring-php-84-exciting-new-features-with-examples-515h</guid>
      <description>&lt;p&gt;The upcoming &lt;strong&gt;PHP 8.4&lt;/strong&gt; release promises to bring several new features and improvements that simplify development and improve performance. As a PHP developer, exploring these changes and understanding how they can impact your projects is always exciting.&lt;/p&gt;

&lt;p&gt;In this article, we’ll walk you through some of the most exciting additions to PHP 8.4 with examples demonstrating how they enhance readability, security, and functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;strong&gt;New Class Instantiation Syntax&lt;/strong&gt; : Cleaner and Simpler
&lt;/h2&gt;

&lt;p&gt;PHP 8.4 introduces a tweak that eliminates the need for parentheses when instantiating a class without constructor arguments. This update might seem minor, but it simplifies code, making it cleaner and easier to read.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before&lt;/span&gt;
&lt;span class="nv"&gt;$dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// After PHP 8.4&lt;/span&gt;
&lt;span class="nv"&gt;$dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how removing the parentheses around &lt;code&gt;new Dog()&lt;/code&gt; reduces visual clutter. While this doesn't add functionality, it improves the developer experience, especially in object-oriented code where such instantiations are common.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why This Change Matters
&lt;/h3&gt;

&lt;p&gt;Although the functional difference is minimal, every bit of syntactic sugar helps make the code more concise. This tweak improves code readability, especially in larger applications where object instantiation is frequent.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. &lt;strong&gt;New Array Helper Functions&lt;/strong&gt; : Efficiently Manage Arrays
&lt;/h2&gt;

&lt;p&gt;PHP 8.4 introduces several new array helper functions that simplify common tasks like searching, checking, and filtering arrays. These functions are inspired by common functional programming patterns, making your code easier to write and more readable.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;array_find&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;array_find()&lt;/code&gt; function allows you to find the first element in an array that matches a specified condition. It's a concise alternative to &lt;code&gt;array_filter()&lt;/code&gt; when you only need the first matching element.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'cat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'elephant'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'goose'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Find the first animal whose name is longer than 4 characters&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: string(8) "elephant"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no matching element is found, &lt;code&gt;array_find()&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt;. This function is a neat alternative to writing a loop or using &lt;code&gt;array_filter()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;array_find_key&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Similar to &lt;code&gt;array_find()&lt;/code&gt;, this function returns the &lt;strong&gt;&lt;em&gt;key&lt;/em&gt;&lt;/strong&gt; of the first matching element instead of the value.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'dog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'b'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'cat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'c'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'elephant'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Find the key of the first animal name longer than 4 characters&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_find_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: string(1) "c"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;array_any&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This function checks whether any element in an array matches a given condition. It returns &lt;code&gt;true&lt;/code&gt; if at least one match is found, and &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'cat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'elephant'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Check if any animal name has more than 7 characters&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: bool(true)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;array_all&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;On the flip side, &lt;code&gt;array_all()&lt;/code&gt; checks whether all elements match a given condition.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'dog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'cat'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'goose'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Check if all animal names are less than 10 characters long&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: bool(true)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why These Functions Are a Game-Changer
&lt;/h3&gt;

&lt;p&gt;These functions reduce boilerplate code, especially when dealing with complex conditions and filters. Instead of writing loops or using array manipulation techniques, you can now achieve the same with a few lines of code.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. &lt;strong&gt;DOM Extension with HTML5 Support&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The DOM extension in PHP 8.4 gets a significant upgrade: full HTML5 parsing and serialization support. This means the DOM extension can now handle modern HTML5 tags and structures, ensuring compatibility with today’s web standards.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;DOM\HTMLDocument&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Create an HTML5 document from a string&lt;/span&gt;
&lt;span class="nv"&gt;$html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HTMLDocument&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;createFromString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;!DOCTYPE html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;Hello, HTML5!&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This feature is especially useful when working with modern web applications that incorporate HTML5 elements. It removes the need for workarounds when parsing and serializing HTML5 documents.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. &lt;strong&gt;Increased Bcrypt Cost for Better Security&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In PHP 8.4, the default &lt;strong&gt;bcrypt&lt;/strong&gt; cost has been increased from 10 to 12. Bcrypt is a password hashing algorithm, and the “cost” determines how computationally intensive the hashing process is. A higher cost makes the hashing process slower, which in turn increases the time required for brute-force attacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Using password_hash() with default bcrypt cost of 12&lt;/span&gt;
&lt;span class="nv"&gt;$hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;password_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my_secret_password'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PASSWORD_BCRYPT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$hash&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This update ensures stronger password protection by default, making it harder for attackers to crack passwords with brute-force attacks.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. &lt;strong&gt;Improved XML Parsing for Large Documents&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;PHP 8.4 introduces a fix for handling large XML documents, addressing an issue in earlier versions where parsing large files could fail due to limitations in the &lt;code&gt;ext/xml&lt;/code&gt; extension. This change is especially helpful for applications that need to handle big datasets, such as APIs or XML-based content management systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;xml_parser_create&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// New option to handle huge XML files&lt;/span&gt;
&lt;span class="nb"&gt;xml_parser_set_option&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$parser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;XML_OPTION_PARSE_HUGE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Parse the large XML file&lt;/span&gt;
&lt;span class="nb"&gt;xml_parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$parser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file_get_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'large.xml'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this update, large XML documents can now be parsed reliably, removing a previous pain point for developers.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. &lt;strong&gt;Multibyte Trimming Functions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;PHP 8.4 adds new multibyte-safe string trimming functions, making it easier to handle strings with multibyte characters. These functions—&lt;code&gt;mb_trim()&lt;/code&gt;, &lt;code&gt;mb_ltrim()&lt;/code&gt;, and &lt;code&gt;mb_rtrim()&lt;/code&gt;—improve upon the previous method of using regular expressions for trimming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;" あいうえお "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$trimmed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;mb_trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$trimmed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: "あいうえお"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These functions ensure that multibyte characters are handled correctly, making internationalization and working with non-ASCII characters easier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PHP 8.4 introduces several exciting features aimed at making development easier and more secure. Whether it's the cleaner class instantiation syntax, powerful new array helper functions, improved DOM extension support for HTML5, or enhanced bcrypt hashing, these changes reflect PHP's ongoing evolution as a modern programming language.&lt;/p&gt;

&lt;p&gt;These improvements reduce repetitive code, improve security, and make working with modern web technologies simpler. With these changes, PHP 8.4 is set to become an even more developer-friendly language, keeping up with contemporary development standards.&lt;/p&gt;

</description>
      <category>php84</category>
      <category>features</category>
      <category>syntax</category>
      <category>array</category>
    </item>
    <item>
      <title>Top 10 VS Code Themes Every Developer Should Try</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Wed, 17 Jul 2024 05:24:08 +0000</pubDate>
      <link>https://dev.to/raziul/top-10-vs-code-themes-every-developer-should-try-3lo6</link>
      <guid>https://dev.to/raziul/top-10-vs-code-themes-every-developer-should-try-3lo6</guid>
      <description>&lt;p&gt;A well-chosen VS Code theme can greatly improve your coding experience. It can reduce eye strain, boost focus, and make coding more enjoyable. With so many options available, picking the right theme can be overwhelming. To help you decide, here are ten excellent VS Code themes loved by developers worldwide.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;a href="https://vscodethemes.com/e/github.github-vscode-theme/github-dark/open?with=desktop" rel="noopener noreferrer"&gt;GitHub Theme&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A familiar and consistent theme that mirrors the look and feel of GitHub itself, with both dark and light versions. Great for developers who spend a lot of time on the platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;a href="https://vscodethemes.com/e/equinusocio.vsc-material-theme/material-theme/open?with=desktop" rel="noopener noreferrer"&gt;Material Theme&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Offers a modern and clean look based on Google's Material Design principles, the Material Theme is known for its great readability and customization options. It provides various color schemes to match different tastes, helping developers pick what feels best for their eyes and coding setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3.&lt;/strong&gt; &lt;a href="https://vscodethemes.com/e/dracula-theme.theme-dracula/dracula-theme/open?with=desktop" rel="noopener noreferrer"&gt;Dracula Theme Official&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A visually striking dark theme with vibrant accents. Perfect for reducing eye strain and creating an immersive coding environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;a href="https://vscodethemes.com/e/zhuangtongfa.material-theme/one-dark-pro/open?with=desktop" rel="noopener noreferrer"&gt;One Dark Pro&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A sophisticated dark theme with subtle color variations that enhance code clarity. Popular for its balanced design and focus on readability.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;a href="https://vscodethemes.com/e/arcticicestudio.nord-visual-studio-code/nord/open?with=desktop" rel="noopener noreferrer"&gt;Nord Theme&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;The Nord theme is a minimalist dark theme featuring a soft color palette, designed to provide a calming and focused coding experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;a href="https://vscodethemes.com/e/enkia.tokyo-night/tokyo-night/open?with=desktop" rel="noopener noreferrer"&gt;Tokyo Night&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Offers a deep and dramatic dark theme with a rich color scheme. Ideal for those who prefer a more distinct look.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. &lt;a href="https://vscodethemes.com/e/azemoh.one-monokai/one-monokai/open?with=desktop" rel="noopener noreferrer"&gt;One Monokai Theme&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A modern take on the classic Monokai theme, providing a touch of nostalgia with a contemporary feel.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. &lt;a href="https://vscodethemes.com/e/robbowen.synthwave-vscode/synthwave-84/open?with=desktop" rel="noopener noreferrer"&gt;SynthWave '84&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This theme adds a retro-futuristic feel to your coding with its neon colors. It's a fun option for those who like 80s nostalgia.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. &lt;a href="https://vscodethemes.com/e/ahmadawais.shades-of-purple/shades-of-purple/open?with=desktop" rel="noopener noreferrer"&gt;Shades of Purple&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;🦄 A professional theme suite with hand-picked &amp;amp; bold shades of purple for your VS Code editor and terminal apps.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;10. Dark Modern&lt;/strong&gt; &lt;em&gt;(Default Theme)&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;The new default Dark Modern theme for VS Code has a balanced dark look with good color contrast. It might not have as many features as other themes, but it's a good choice for beginners or those who like a simpler style.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are some additional thoughts on your selection:&lt;/strong&gt; You have a nice mix of light and dark themes for different tastes. Adding SynthWave '84 brings some fun and shows you're open to unique choices. Including the default theme is useful for new VS Code users. You can find more themes at &lt;a href="https://vscodethemes.com/" rel="noopener noreferrer"&gt;https://vscodethemes.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this breakdown provides some insights into your theme choices. If you'd like to delve deeper into any specific theme or explore customization options, feel free to ask!&lt;/p&gt;

</description>
      <category>themes</category>
      <category>vscode</category>
      <category>vscodeextensions</category>
    </item>
    <item>
      <title>Implementing User Suspension in Your Laravel Application</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Sun, 30 Jun 2024 03:06:28 +0000</pubDate>
      <link>https://dev.to/raziul/implementing-user-suspension-in-your-laravel-application-1o03</link>
      <guid>https://dev.to/raziul/implementing-user-suspension-in-your-laravel-application-1o03</guid>
      <description>&lt;p&gt;This guide will walk through implementing user suspension in a Laravel application. This functionality allows you to temporarily or permanently suspend users and notify them accordingly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Add Suspension Columns to the Users Table
&lt;/h2&gt;

&lt;p&gt;First, we need to update our &lt;code&gt;users&lt;/code&gt; table to include columns for tracking suspension status and reason.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new migration:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:migration add_suspension_columns_to_users_table &lt;span class="nt"&gt;--table&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;users&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;In the migration file, add the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Database\Migrations\Migration&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Database\Schema\Blueprint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Support\Facades\Schema&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Migration&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Blueprint&lt;/span&gt; &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'suspended_at'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;nullable&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;nullable&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'suspension_reason'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;nullable&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;down&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'users'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Blueprint&lt;/span&gt; &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;dropColumn&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
                &lt;span class="s1"&gt;'suspended_at'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'suspension_reason'&lt;/span&gt;
            &lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run the migration
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Update the User Model
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;app/Models/User.php&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;Suspendable&lt;/code&gt; trait and add the necessary attribute casts:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Traits\Suspendable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="mf"&gt;...&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Authenticatable&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="mf"&gt;...&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Suspendable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$casts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'email_verified_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'hashed'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'suspended_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel 11 and newer versions utilize &lt;code&gt;casts&lt;/code&gt; methods for property casting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;casts&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'email_verified_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'hashed'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'suspended_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'datetime'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Create the Suspendable Trait
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a new PHP file at &lt;code&gt;app/Traits/Suspendable.php&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add the following code to that file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Traits&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Notifications\UserSuspendedNotification&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Notifications\UserUnsuspendedNotification&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Carbon\CarbonInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Database\Eloquent\Casts\Attribute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;Suspendable&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cd"&gt;/**
     * Account is banned for lifetime.
     */&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;isBanned&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;Attribute&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Attribute&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspended_at&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;is_null&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspension_ends_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Account is suspended for some time.
     */&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;isSuspended&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;Attribute&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Attribute&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspended_at&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspension_ends_at&lt;/span&gt;&lt;span class="o"&gt;?-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;isFuture&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Suspend account and notify them.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;suspend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$reason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;CarbonInterface&lt;/span&gt; &lt;span class="nv"&gt;$ends_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s1"&gt;'suspended_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="s1"&gt;'suspension_reason'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$reason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$ends_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserSuspendedNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Un-suspend account and notify them.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;unsuspend&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspended_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s1"&gt;'suspended_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'suspension_reason'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'suspension_ends_at'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserUnsuspendedNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This trait adds the &lt;code&gt;suspend&lt;/code&gt; and &lt;code&gt;unsuspend&lt;/code&gt; methods to the &lt;code&gt;User&lt;/code&gt; model for suspending and unsuspending accounts easily. This also provides the &lt;code&gt;is_banned&lt;/code&gt; and &lt;code&gt;is_suspended&lt;/code&gt; attributes for checking suspension status.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Create Notifications
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create notification classes:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:notification UserSuspendedNotification
php artisan make:notification UserUnsuspendedNotification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Edit &lt;code&gt;app/Notifications/UserSuspendedNotification.php&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Notifications&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Models\User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Bus\Queueable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Contracts\Queue\ShouldQueue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Notifications\Messages\MailMessage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Notifications\Notification&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserSuspendedNotification&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Notification&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Queueable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;User&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Get the notification's delivery channels.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nv"&gt;$notifiable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'mail'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Get the mail representation of the notification.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;toMail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nv"&gt;$notifiable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;MailMessage&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;is_banned&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Your account has been banned'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Your account has been suspended'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nv"&gt;$message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Suspension will end on: :date'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'date'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspention_ends_at&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MailMessage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$subject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$subject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Reason: **:reason**'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'reason'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;suspension_reason&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'If you believe this is a mistake, please contact us.'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thank you for your understanding.'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Edit &lt;code&gt;app/Notifications/UserUnsuspendedNotification.php&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Notifications&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Models\User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Bus\Queueable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Contracts\Queue\ShouldQueue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Notifications\Messages\MailMessage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Notifications\Notification&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserUnsuspendedNotification&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Notification&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Queueable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kt"&gt;User&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Get the notification's delivery channels.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nv"&gt;$notifiable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'mail'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="cd"&gt;/**
     * Get the mail representation of the notification.
     */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;toMail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nv"&gt;$notifiable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;MailMessage&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MailMessage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Your Suspension Removed'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Hello :name,'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Suspension has been removed. Your account is now active.'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'You can now log into your account.'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Log in'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'login'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thank you for staying with us.'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are almost done 😀 Let's take a look at the usage example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;\App\Models\User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// temporary suspension (for 7 days)&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;suspend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'suspension reason'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;addDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// permanent suspension&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;suspend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'suspension reason'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// unsuspension&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;unsuspend&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, The only thing that remains is to check whether the authenticated user is suspended and restrict their access to the application. Let's do this in the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Restrict Application Access for Suspended Users
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create Middleware
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:middleware CheckUserSuspension
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;In the middleware file &lt;code&gt;app/Http/Middleware/CheckUserSuspension.php&lt;/code&gt;, add the following logic to handle restricted access for suspended users:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Http\Middleware&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Closure&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\HttpFoundation\Response&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CheckUserSuspension&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Request&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;Closure&lt;/span&gt; &lt;span class="nv"&gt;$next&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;Response&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;user&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="nf"&gt;abort_if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;is_suspended&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;is_banned&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;HTTP_FORBIDDEN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nf"&gt;__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Your account has been suspended or banned. Check your email for details.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Apply Middleware to Routes:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In &lt;code&gt;routes/web.php&lt;/code&gt; or &lt;code&gt;routes/api.php&lt;/code&gt; apply the middleware to the routes you want to protect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Middleware\CheckUserSuspension&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Protected routes&lt;/span&gt;
&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'middleware'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'auth'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;CheckUserSuspension&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/dashboard'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;DashboardController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Other routes&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise, you can add this middleware to the &lt;code&gt;web&lt;/code&gt; or &lt;code&gt;api&lt;/code&gt; middleware group to apply it to a set of routes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Applying to Middleware Groups (optional)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Laravel 11 or newer
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// file: bootstrap/app.php&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Http\Middleware\CheckUserSuspension&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Application&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;basePath&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="c1"&gt;// other code&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;withMiddleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Middleware&lt;/span&gt; &lt;span class="nv"&gt;$middleware&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$middleware&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;web&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nc"&gt;CheckUserSuspension&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="c1"&gt;// other code&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;For Laravel 10 or older
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// file: app/Http/Kernel.php&lt;/span&gt;

    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$middlewareGroups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'web'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="c1"&gt;// other middlewares&lt;/span&gt;
            &lt;span class="nc"&gt;CheckUserSuspension&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;

        &lt;span class="s1"&gt;'api'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="c1"&gt;// other middlewares&lt;/span&gt;
            &lt;span class="nc"&gt;CheckUserSuspension&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By following this guide, you have successfully implemented user suspension functionality in your Laravel application. This approach keeps your &lt;code&gt;User&lt;/code&gt; model clean and encapsulates the suspension logic within a reusable &lt;code&gt;Suspendable&lt;/code&gt; trait.&lt;/p&gt;

&lt;p&gt;This feature allows you to manage user access effectively by suspending and unsuspending users as needed. This not only enhances the security and control over user activities but also ensures a better user management system.&lt;/p&gt;

&lt;p&gt;Happy coding! ❤️&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>eloquent</category>
    </item>
    <item>
      <title>Simplify Slug Creation for Eloquent Models in Laravel</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Tue, 09 Jan 2024 00:00:00 +0000</pubDate>
      <link>https://dev.to/raziul/simplify-slug-creation-for-eloquent-models-in-laravel-44of</link>
      <guid>https://dev.to/raziul/simplify-slug-creation-for-eloquent-models-in-laravel-44of</guid>
      <description>&lt;p&gt;Creating clean and user-friendly URLs is an essential aspect of every website for SEO. Laravel provides a helper &lt;code&gt;Illuminate\Support\Str::slug&lt;/code&gt; for transforming string into URL-friendly slug, But this is not enough for our models to generate slugs automatically.&lt;/p&gt;

&lt;p&gt;In this article, We'll create a custom &lt;code&gt;HasSlug&lt;/code&gt; trait that simplifies the process of generating slugs and explore how it can seamlessly enhance your Laravel models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining the Custom &lt;code&gt;HasSlug&lt;/code&gt; Trait
&lt;/h2&gt;

&lt;p&gt;Let's start by creating a custom &lt;code&gt;HasSlug&lt;/code&gt; trait:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Concerns&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// your namespace&lt;/span&gt;

&lt;span class="kd"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;HasSlug&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;slugKey&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;'slug'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;abstract&lt;/span&gt; &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sluggable&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the &lt;code&gt;slugKey&lt;/code&gt; method returns the name of the key that stores the slug. This method is used to determine the default key for the slug attribute. Default is 'slug'.&lt;/p&gt;

&lt;p&gt;Also, a &lt;code&gt;sluggable&lt;/code&gt; abstract method, Which should be implemented by the model and return the name of the attribute that should be used for slug generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Boot Method for Slug Generation
&lt;/h2&gt;

&lt;p&gt;Next, let's implement the boot method for automatic slug generation during model creation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;bootHasSlug&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;creating&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Model&lt;/span&gt; &lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;slugKey&lt;/span&gt;&lt;span class="p"&gt;()})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;slugKey&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;generateUniqueSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$model&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sluggable&lt;/span&gt;&lt;span class="p"&gt;()});&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This boot method ensures that &lt;code&gt;HasSlug&lt;/code&gt; trait takes action when a model is being created, automatically generating a unique slug if it is not already set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unique Slug Generation Logic
&lt;/h2&gt;

&lt;p&gt;Let's implement the &lt;code&gt;generateUniqueSlug&lt;/code&gt; method that generates a unique slug based on the given string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;generateUniqueSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;?string&lt;/span&gt; &lt;span class="nv"&gt;$str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;?string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$strSlug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Str&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$str&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$strSlug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;whereSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$strSlug&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;'-'&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;$counter&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method generates a unique slug based on the given string, checking if it already exists in the database. If it does, it appends a counter to the slug to generate a unique value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query Scopes and Finder Methods
&lt;/h2&gt;

&lt;p&gt;Next, implement the &lt;code&gt;whereSlug&lt;/code&gt; scope and &lt;code&gt;findBySlug&lt;/code&gt;, &lt;code&gt;findBySlugOrFail&lt;/code&gt; methods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;scopeWhereSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Builder&lt;/span&gt; &lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;Builder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;slugKey&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;findBySlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'*'&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt; &lt;span class="kt"&gt;static&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;whereSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$columns&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;findBySlugOrFail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'*'&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt; &lt;span class="kt"&gt;static&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;whereSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$slug&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;firstOrFail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$columns&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These methods simplify the process of querying models based on their slugs, making your code more readable and efficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making it Model-Specific
&lt;/h2&gt;

&lt;p&gt;To tie everything together, your model needs to implement the abstract &lt;code&gt;sluggable&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;abstract&lt;/span&gt; &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sluggable&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your actual model, you specify which attribute should be used for slugging by returning its name in the &lt;code&gt;sluggable&lt;/code&gt; method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing in Your Model
&lt;/h2&gt;

&lt;p&gt;Now, let's consider an example with a &lt;code&gt;Post&lt;/code&gt; model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Concerns\HasSlug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;HasSlug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$fillable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'slug'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'body'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sluggable&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;'title'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Use the 'title' attribute for slugging&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Other model-specific code...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By implementing the &lt;code&gt;HasSlug&lt;/code&gt; trait and specifying the &lt;code&gt;title&lt;/code&gt; attribute for slugging, you enable slugging functionality effortlessly.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'title'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'My Post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'body'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'This is my post body.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Output: my-post&lt;/span&gt;

&lt;span class="nv"&gt;$another&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'title'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'My Post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'body'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Another post with same title.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$another&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Output: my-post-1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, now you can generate slugs for your models seamlessly by just using the &lt;code&gt;HasSlug&lt;/code&gt; trait and specifying the &lt;code&gt;sluggable&lt;/code&gt; attribute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Creating a custom &lt;code&gt;HasSlug&lt;/code&gt; trait for slug generation allows for a tailored and simplified slug generation logic. It also simplifies the process of querying models based on their slugs, making your code more readable and efficient.&lt;/p&gt;

&lt;p&gt;You can check out the &lt;a href="https://github.com/iRaziul/larabits/blob/main/eloquent/traits/HasSlug.php" rel="noopener noreferrer"&gt;Source Code&lt;/a&gt; for more details.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>eloquent</category>
      <category>slug</category>
    </item>
    <item>
      <title>Enhance Your Development Experience with PHP Intelephense for VS Code</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Fri, 07 Apr 2023 05:49:49 +0000</pubDate>
      <link>https://dev.to/raziul/enhance-your-development-experience-with-php-intelephense-for-vs-code-9on</link>
      <guid>https://dev.to/raziul/enhance-your-development-experience-with-php-intelephense-for-vs-code-9on</guid>
      <description>&lt;p&gt;&lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Visual Studio Code&lt;/strong&gt;&lt;/a&gt; is a widely popular code editor that is known for its flexibility and wide range of features. It's widely regarded as one of the best code editors for &lt;strong&gt;TypeScript&lt;/strong&gt; development, thanks to its robust TypeScript support.&lt;/p&gt;

&lt;p&gt;However, when it comes to &lt;a href="https://php.net/" rel="noopener noreferrer"&gt;&lt;strong&gt;PHP programming&lt;/strong&gt;&lt;/a&gt;, VS Code does not offer the same level of support and functionality out-of-the-box. While VS Code does come with built-in support for PHP, it lacks some of the more advanced features that are essential for efficient PHP development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wH6NbY2i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680845618315/767680d7-382c-4ed1-bf52-416463c2b12f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wH6NbY2i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680845618315/767680d7-382c-4ed1-bf52-416463c2b12f.png" alt="PHP code intelligence for Visual Studio Code." width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get the most out of &lt;strong&gt;VS Code for PHP development&lt;/strong&gt; , developers often need to install additional extensions or plugins, such as &lt;a href="https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client" rel="noopener noreferrer"&gt;&lt;strong&gt;PHP Intelephense&lt;/strong&gt;&lt;/a&gt;, which can provide more advanced PHP support. With the help of these extensions, developers can take advantage of features like intelligent code completion, syntax highlighting, and debugging tools, making VS Code a more viable option for PHP development.&lt;/p&gt;

&lt;p&gt;Here's a closer look at what &lt;a href="https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client" rel="noopener noreferrer"&gt;&lt;strong&gt;PHP Intelephense&lt;/strong&gt;&lt;/a&gt; can do for you:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Intelligent Code Completion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of the most useful features of PHP Intelephense is its intelligent code completion. This feature helps you write code faster and with fewer errors by suggesting possible options as you type. For example, if you're working with a class that has several methods, PHP Intelephense will suggest the available methods as you type the object name followed by a dot.&lt;/p&gt;

&lt;p&gt;This feature is especially useful when you're working with complex codebases that have many classes, methods, and variables. With PHP Intelephense, you don't have to remember everything off the top of your head because the extension will suggest the available options for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Syntax Highlighting and Error Detection&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Another important feature of PHP Intelephense is its syntax highlighting and error detection. This extension can detect syntax errors in your code as you type and highlight them with red underlines, making it easy to identify and correct errors before they become a problem.&lt;/p&gt;

&lt;p&gt;Syntax highlighting is also helpful because it makes it easier to read and understand your code. PHP Intelephense uses different colors and fonts to highlight different elements of your code, such as variables, functions, and keywords.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Refactoring&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Refactoring is the process of restructuring code without changing its behavior. It's an essential part of maintaining and improving codebases, and PHP Intelephense can help make it easier.&lt;/p&gt;

&lt;p&gt;With PHP Intelephense, you can use the "Rename Symbol" feature to quickly rename variables, classes, methods, and other elements of your code. This feature is especially helpful when you're refactoring large codebases and need to change multiple occurrences of a variable or function.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code Snippets&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Code snippets are pre-written pieces of code that you can insert into your own code to save time and reduce errors. PHP Intelephense includes several code snippets that you can use to speed up your development process.&lt;/p&gt;

&lt;p&gt;For example, if you need to create a new PHP class, you can use the "Class" code snippet to generate the basic structure of a class. You can also use code snippets to create functions, loops, and other common programming constructs.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Configuration Options&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;PHP Intelephense is highly customizable, and you can configure it to work the way you want. For example, you can specify the PHP version that you're using, which can help the extension provide better code completion and error detection.&lt;/p&gt;

&lt;p&gt;You can also configure PHP Intelephense to ignore certain files or directories, which can be useful when you're working with third-party libraries or other code that you don't need to modify.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;PHP Intelephense is an essential extension for PHP developers who use Visual Studio Code. Its intelligent code completion, syntax highlighting, and error detection features can save you a lot of time and make your development process more efficient. And with its customizable configuration options, you can tailor PHP Intelephense to work the way you want. So if you're not already using PHP Intelephense, give it a try and see how much it can improve your workflow.&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>editor</category>
      <category>vscode</category>
    </item>
    <item>
      <title>5 Must-Try No-Code AI Tools for Web Developers: Simplify Your Workflow Today!</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Fri, 31 Mar 2023 06:40:22 +0000</pubDate>
      <link>https://dev.to/raziul/5-must-try-no-code-ai-tools-for-web-developers-simplify-your-workflow-today-5a7p</link>
      <guid>https://dev.to/raziul/5-must-try-no-code-ai-tools-for-web-developers-simplify-your-workflow-today-5a7p</guid>
      <description>&lt;p&gt;As a web developer, your workflow can be complex and time-consuming. But what if you could simplify your processes without sacrificing quality? Enter no-code AI tools - a game-changing solution that can help you boost productivity and streamline your workload.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore &lt;strong&gt;five must-try no-code AI tools&lt;/strong&gt; that can help you work smarter, not harder.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1.&lt;/strong&gt; &lt;a href="https://zipchat.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;ZipChat AI&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Create an AI-powered chatbot for your website in less than 30 seconds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simply paste your website's URL&lt;/li&gt;
&lt;li&gt;ZipChat AI algorithm will handle everything&lt;/li&gt;
&lt;li&gt;Instant answers to your customer's questions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2.&lt;/strong&gt; &lt;a href="https://bubble.io/ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Bubble&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;You can build AI-powered apps without code.&lt;/p&gt;

&lt;p&gt;Build, test, and scale apps with all the latest technologies including OpenAI and ChatGPT.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3.&lt;/strong&gt; &lt;a href="https://uizard.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;Uizard io&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Uizard is a rapid prototyping tool that AI powers to generate the fastest results without much effort.&lt;/p&gt;

&lt;p&gt;It can convert hand-drawn sketches into fully-fledged and high-fidelity prototypes.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4.&lt;/strong&gt; &lt;a href="https://sitekick.ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Sitekick&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Sitekick&lt;/strong&gt; is an AI landing page builder.&lt;/p&gt;

&lt;p&gt;It allows you to create beautiful landing pages without the need for coding, design, or copywriting skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5.&lt;/strong&gt; &lt;a href="https://levity.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;Levity&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Levity is a no-code Al workflow automation platform that helps you automate your daily tasks.&lt;/p&gt;

&lt;p&gt;With powerful Al at your fingertips, you can stop manually processing text, document, and image data without writing a single line of code.&lt;/p&gt;

&lt;p&gt;These no-code AI tools offer a cost-effective and efficient way to optimize your workflow as a web developer. From automating repetitive tasks to improving user experience and content creation, the possibilities are endless. So why not give these tools a try and see how they can transform your workflow today?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>aitools</category>
    </item>
    <item>
      <title>5 Must-Try No-Code AI Tools for Web Developers: Simplify Your Workflow Today</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Fri, 31 Mar 2023 06:40:22 +0000</pubDate>
      <link>https://dev.to/raziul/5-must-try-no-code-ai-tools-for-web-developers-simplify-your-workflow-today-1bo</link>
      <guid>https://dev.to/raziul/5-must-try-no-code-ai-tools-for-web-developers-simplify-your-workflow-today-1bo</guid>
      <description>&lt;p&gt;As a web developer, your workflow can be complex and time-consuming. But what if you could simplify your processes without sacrificing quality? Enter no-code AI tools - a game-changing solution that can help you boost productivity and streamline your workload.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore &lt;strong&gt;five must-try no-code AI tools&lt;/strong&gt; that can help you work smarter, not harder.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1.&lt;/strong&gt; &lt;a href="https://zipchat.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;ZipChat AI&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---Jpd4oxg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680240599766/e1ca9c60-5eb1-4941-8bbe-8f9bb62fa2c1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---Jpd4oxg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680240599766/e1ca9c60-5eb1-4941-8bbe-8f9bb62fa2c1.png" alt="ZipChat AI" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create an AI-Powered ChatBot for your website in less than 30 seconds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simply paste your website's URL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ZipChat AI algorithm will handle everything&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instant answers to your customer's questions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2.&lt;/strong&gt; &lt;a href="https://bubble.io/ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Bubble&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6xlHntJn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680242011693/d1a9ab95-a98a-42cf-9d33-66b396ca215f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6xlHntJn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680242011693/d1a9ab95-a98a-42cf-9d33-66b396ca215f.png" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can build AI-powered apps without code.&lt;/p&gt;

&lt;p&gt;Build, test, and scale apps with all the latest technologies including OpenAI and ChatGPT.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3.&lt;/strong&gt; &lt;a href="https://uizard.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;Uizard io&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZF7zm_EG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680242164253/c73efb4b-e082-4ceb-a529-8f09d6a63c83.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZF7zm_EG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680242164253/c73efb4b-e082-4ceb-a529-8f09d6a63c83.png" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uizard is a rapid prototyping tool that AI powers to generate the fastest results without much effort.&lt;/p&gt;

&lt;p&gt;It can convert hand-drawn sketches into fully-fledged and high-fidelity prototypes.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4.&lt;/strong&gt; &lt;a href="https://sitekick.ai" rel="noopener noreferrer"&gt;&lt;strong&gt;Sitekick&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mVGZjiFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680244398725/80a09f15-ae9c-409a-86b2-baecc21c1be6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mVGZjiFO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680244398725/80a09f15-ae9c-409a-86b2-baecc21c1be6.png" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sitekick&lt;/strong&gt; is an AI landing page builder.&lt;/p&gt;

&lt;p&gt;It allows you to create beautiful landing pages without the need for coding, design, or copywriting skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5.&lt;/strong&gt; &lt;a href="https://levity.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;Levity&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GpW_SrhN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680244607208/acb3787f-a1ff-4fdd-bb03-05847853ab84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GpW_SrhN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680244607208/acb3787f-a1ff-4fdd-bb03-05847853ab84.png" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Levity is a no-code Al workflow automation platform that helps you automate your daily tasks.&lt;/p&gt;

&lt;p&gt;With powerful Al at your fingertips, you can stop manually processing text, document, and image data without writing a single line of code.&lt;/p&gt;

&lt;p&gt;These no-code AI tools offer a cost-effective and efficient way to optimize your workflow as a web developer. From automating repetitive tasks to improving user experience and content creation, the possibilities are endless. So why not give these tools a try and see how they can transform your workflow today?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>development</category>
      <category>code</category>
      <category>tools</category>
    </item>
    <item>
      <title>Top Freemium Online Resources for Career Development in 2023</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Thu, 30 Mar 2023 17:02:17 +0000</pubDate>
      <link>https://dev.to/raziul/top-freemium-online-resources-for-career-development-in-2023-bpj</link>
      <guid>https://dev.to/raziul/top-freemium-online-resources-for-career-development-in-2023-bpj</guid>
      <description>&lt;p&gt;In today's fast-paced world, it's crucial to stay ahead of the curve when it comes to career development. Fortunately, there are many free resources available online that can help you improve your skills, prepare for interviews, and build a strong portfolio.&lt;/p&gt;

&lt;p&gt;In this article, we've compiled a list of &lt;strong&gt;top sites for freelancing, tech skills, resume reviews, interview preparation, graphic design, and portfolio building&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top 5 freelancing websites
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.upwork.com/" rel="noopener noreferrer"&gt;Upwork&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.fiverr.com/" rel="noopener noreferrer"&gt;Fiverr&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.freelancer.com/" rel="noopener noreferrer"&gt;Freelancer.com&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.guru.com/" rel="noopener noreferrer"&gt;Guru.com&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.toptal.com/" rel="noopener noreferrer"&gt;Toptal&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're looking for freelance work, these are the top five websites to check out. Each website has its own strengths and weaknesses, so it's worth exploring each one to find the right fit for your skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top 10 Sites for your career
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://linkedin.com/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://Indeed.com" rel="noopener noreferrer"&gt;Indeed.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://naukri.com" rel="noopener noreferrer"&gt;Naukri.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.monster.com/" rel="noopener noreferrer"&gt;Monster&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://heyjobba.com/register/" rel="noopener noreferrer"&gt;JOBBA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.careercloud.com/" rel="noopener noreferrer"&gt;CareerCloud LLC&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.dice.com/" rel="noopener noreferrer"&gt;Dice&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.careerbuilder.com/" rel="noopener noreferrer"&gt;CareerBuilder&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://rozee.pk" rel="noopener noreferrer"&gt;Rozee&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.glassdoor.com/" rel="noopener noreferrer"&gt;Glassdoor&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whether you're looking for job postings or networking opportunities, these career sites are a great resource for finding your next opportunity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top Sites for Online Education
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.coursera.org/" rel="noopener noreferrer"&gt;Coursera&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.edx.org/" rel="noopener noreferrer"&gt;edX&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.udemy.com/" rel="noopener noreferrer"&gt;Udemy&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.simplilearn.com/" rel="noopener noreferrer"&gt;Simplilearn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtube.com" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whether you're looking to learn a new tech skill or brush up on your existing knowledge, these online education sites are an excellent resource.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top Sites to review your resume
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://zety.com/" rel="noopener noreferrer"&gt;Zety&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.resumonk.com/" rel="noopener noreferrer"&gt;Resumonk&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.visualcv.com/" rel="noopener noreferrer"&gt;VisualCV&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cvmkr.com/" rel="noopener noreferrer"&gt;CVMaker&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A strong resume is essential for landing your next job, and these websites offer review services to help you make sure your resume is in top shape.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top Site for your Portfolio
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dribbble.com/" rel="noopener noreferrer"&gt;Dribbble&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.behance.net/" rel="noopener noreferrer"&gt;Behance&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're a designer, developer, or creative professional, having a strong portfolio is essential. These sites offer a great platform for showcasing your work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In conclusion, staying ahead of the curve in 2023 means taking advantage of the many resources available online. From freelancing websites to career sites, tech skills in demand, and free education resources, there's something for everyone.&lt;/p&gt;

</description>
      <category>design</category>
      <category>career</category>
      <category>resources</category>
      <category>freelancing</category>
    </item>
    <item>
      <title>Why Choose Laravel for Web Application Development?</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Tue, 28 Mar 2023 10:53:08 +0000</pubDate>
      <link>https://dev.to/raziul/why-choose-laravel-for-web-application-development-1jbd</link>
      <guid>https://dev.to/raziul/why-choose-laravel-for-web-application-development-1jbd</guid>
      <description>&lt;p&gt;&lt;a href="https://laravel.com" rel="noopener noreferrer"&gt;&lt;strong&gt;Laravel&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;is a popular PHP framework&lt;/strong&gt; that offers many benefits for building &lt;strong&gt;robust&lt;/strong&gt; and &lt;strong&gt;scalable web applications&lt;/strong&gt;. It comes with a wide range of features and tools that make development faster, easier, and more efficient.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore the &lt;strong&gt;key benefits of using Laravel for web application development.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Rapid Application Development&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One of the primary benefits of Laravel is its focus on rapid application development. It comes with an extensive set of built-in features and tools that make it easy to get started with development right away. Laravel provides out-of-the-box support for features like authentication and authorization, routing, templating engine, ORM, and many more. This allows developers to focus on building the core logic of their application instead of spending time on repetitive tasks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HeSbsjNj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680000298091/72bf8668-87ba-4600-9f55-ab1bf30f4230.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HeSbsjNj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1680000298091/72bf8668-87ba-4600-9f55-ab1bf30f4230.png" alt="Routing syntax of Laravel framework" width="746" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Clean and Elegant Syntax&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel has a simple and elegant syntax that makes it easy to read and write code. It follows the best practices of modern PHP development, including object-oriented programming principles, dependency injection, and inversion of control. The framework also comes with many built-in functions and methods that simplify common tasks like database operations, form handling, and error reporting.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;MVC Architecture&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel follows the Model-View-Controller (MVC) architecture pattern, which separates the application logic into three interconnected components. This helps developers to maintain clean and organized code that is easy to modify and extend. The MVC architecture facilitates testing and debugging, as each component can be tested independently.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Artisan Command-Line Interface&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel comes with a powerful command-line interface called Artisan, which provides a wide range of tools and commands for automating repetitive tasks. With Artisan, developers can easily create migrations, generate controllers, run tests, and perform many other tasks. This saves a lot of time and effort, especially for large and complex projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Eloquent ORM&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel's Eloquent ORM provides an intuitive and easy-to-use way to work with databases. It simplifies database operations by providing a simple and expressive syntax for querying and manipulating data. Eloquent also supports relationships between tables, making it easy to define and work with complex data models.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Testing and Debugging Tools&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel comes with built-in support for unit testing and debugging, making it easier to ensure that your code is working correctly. The framework provides a range of testing tools like PHPUnit, Mockery, and BrowserKit, which allow developers to test their application's functionality at various levels. Laravel also provides detailed error messages and stack traces, making identifying and fixing bugs easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Large and Active Community&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Laravel has a large and active community of developers and users, which provides comprehensive documentation, tutorials, and support. The framework also has a dedicated forum where users can ask questions and get help from other developers. Laravel also has a large number of third-party packages and plugins that can be used to extend its functionality.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In conclusion, Laravel is a powerful PHP framework that offers many benefits for web application development. Its focus on rapid application development, clean and elegant syntax, MVC architecture, Artisan CLI, Eloquent ORM, and testing and debugging tools makes it a popular choice for developers worldwide. Additionally, Laravel has a large and active community of developers and users, which provides comprehensive documentation, tutorials, and support. If you're planning to build a web application using PHP, Laravel is definitely worth considering.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>framework</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Boost Your Tailwind CSS Workflow with VS Code Extensions</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Thu, 02 Mar 2023 15:10:09 +0000</pubDate>
      <link>https://dev.to/raziul/boost-your-tailwind-css-workflow-with-vs-code-extensions-46k8</link>
      <guid>https://dev.to/raziul/boost-your-tailwind-css-workflow-with-vs-code-extensions-46k8</guid>
      <description>&lt;p&gt;If you're a web developer using &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;TailwindCSS&lt;/a&gt;, you know how important it is to have the right tools to improve your workflow and productivity. &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; is a popular code editor with a great collection of extensions, making it an excellent choice for developers who work with TailwindCSS.&lt;/p&gt;

&lt;p&gt;In this article, we'll cover some of the must-have &lt;strong&gt;Visual Studio Code extensions for TailwindCSS that can help you improve your workflow and productivity.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://dev.to/scottw/tailwind-css-intellisense-4b3e-temp-slug-8675760"&gt;&lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt; is an extension that provides autocomplete for TailwindCSS classes in your HTML, CSS, and JavaScript files. By using this extension, you can save time and improve your productivity by quickly accessing Tailwind's utility classes.&lt;/p&gt;

&lt;p&gt;You can install the &lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt; extension from the &lt;strong&gt;Visual Studio Code Marketplace&lt;/strong&gt;. Once installed, you can start using the extension right away.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=heybourn.headwind" rel="noopener noreferrer"&gt;&lt;strong&gt;Headwind&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Headwind&lt;/strong&gt; is an extension that automatically organizes your CSS classes in your code to follow the same order as Tailwind's documentation. This makes it easier to find and modify your classes, improving your workflow and productivity.&lt;/p&gt;

&lt;p&gt;To install &lt;strong&gt;Headwind&lt;/strong&gt; , open VS Code and search for "Headwind" in the Extensions Marketplace.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=moalamri.inline-fold" rel="noopener noreferrer"&gt;&lt;strong&gt;Inline Fold&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TailwindCSS&lt;/strong&gt; is a utility-first CSS framework that uses a lot of utility classes. This can make your code difficult to read and understand. &lt;strong&gt;Inline Fold&lt;/strong&gt; is an extension that folds the classes to &lt;strong&gt;make your code easier to read and understand&lt;/strong&gt;. You can expand the folds by clicking on them.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=shadowblood.tailwind-moon" rel="noopener noreferrer"&gt;&lt;strong&gt;Tailwind Colour Theme&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tailwind Colour Theme&lt;/strong&gt; is an extension that provides a color scheme for your Visual Studio Code editor that matches Tailwind's default color palette. This can help you stay focused and improve your coding experience by providing a familiar color scheme.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In conclusion, these are some of the must-have &lt;strong&gt;Visual Studio Code extensions&lt;/strong&gt; for &lt;strong&gt;TailwindCSS&lt;/strong&gt;. By using these extensions, you can streamline your development process and make it easier to work with TailwindCSS in Visual Studio Code. Whether you're a beginner or an experienced developer, &lt;strong&gt;these extensions can help you improve your workflow and productivity.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>vscode</category>
      <category>tailwindcss</category>
      <category>vscodeextensions</category>
    </item>
    <item>
      <title>Boost Your TailwindCSS Workflow with VS Code Extensions</title>
      <dc:creator>Raziul Islam</dc:creator>
      <pubDate>Thu, 02 Mar 2023 15:10:09 +0000</pubDate>
      <link>https://dev.to/raziul/boost-your-tailwindcss-workflow-with-vs-code-extensions-2ib9</link>
      <guid>https://dev.to/raziul/boost-your-tailwindcss-workflow-with-vs-code-extensions-2ib9</guid>
      <description>&lt;p&gt;If you're a web developer using &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;TailwindCSS&lt;/a&gt;, you know how important it is to have the right tools to improve your workflow and productivity. &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; is a popular code editor with a great collection of extensions, making it an excellent choice for developers who work with TailwindCSS.&lt;/p&gt;

&lt;p&gt;In this article, we'll cover some of the must-have &lt;strong&gt;Visual Studio Code extensions for TailwindCSS that can help you improve your workflow and productivity.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://dev.to/scottw/tailwind-css-intellisense-4b3e-temp-slug-8675760"&gt;&lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UFQSgrDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677756963835/df4b8f04-c3d5-4637-9a70-e6fb218428ce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UFQSgrDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677756963835/df4b8f04-c3d5-4637-9a70-e6fb218428ce.png" alt="The official Tailwind CSS IntelliSense extension for Visual Studio Code" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt; is an extension that provides autocomplete for TailwindCSS classes in your HTML, CSS, and JavaScript files. By using this extension, you can save time and improve your productivity by quickly accessing Tailwind's utility classes.&lt;/p&gt;

&lt;p&gt;You can install the &lt;strong&gt;Tailwind CSS IntelliSense&lt;/strong&gt; extension from the &lt;strong&gt;Visual Studio Code Marketplace&lt;/strong&gt;. Once installed, you can start using the extension right away.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=heybourn.headwind" rel="noopener noreferrer"&gt;&lt;strong&gt;Headwind&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--runf_4yz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677757763734/bf1e34cb-58af-440a-95ec-973d3e8319bb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--runf_4yz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677757763734/bf1e34cb-58af-440a-95ec-973d3e8319bb.gif" alt="Headwind VS Code Extension" width="800" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Headwind&lt;/strong&gt; is an extension that automatically organizes your CSS classes in your code to follow the same order as Tailwind's documentation. This makes it easier to find and modify your classes, improving your workflow and productivity.&lt;/p&gt;

&lt;p&gt;To install &lt;strong&gt;Headwind&lt;/strong&gt; , open VS Code and search for "Headwind" in the Extensions Marketplace.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=moalamri.inline-fold" rel="noopener noreferrer"&gt;&lt;strong&gt;Inline Fold&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kNfsBgWR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/moalamri/vscode-inline-fold/master/res/preview.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kNfsBgWR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/moalamri/vscode-inline-fold/master/res/preview.png" alt="Inline Fold VS Code Extension (Preview)" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TailwindCSS&lt;/strong&gt; is a utility-first CSS framework that uses a lot of utility classes. This can make your code difficult to read and understand. &lt;strong&gt;Inline Fold&lt;/strong&gt; is an extension that folds the classes to &lt;strong&gt;make your code easier to read and understand&lt;/strong&gt;. You can expand the folds by clicking on them.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=shadowblood.tailwind-moon" rel="noopener noreferrer"&gt;&lt;strong&gt;Tailwind Colour Theme&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0DV5I0rA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/luciascarlet/tailwind-moon-vscode/raw/HEAD/screenshots/scr-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0DV5I0rA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/luciascarlet/tailwind-moon-vscode/raw/HEAD/screenshots/scr-1.png" alt="Screenshot of Tailwind Moon theme with sample code" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tailwind Colour Theme&lt;/strong&gt; is an extension that provides a color scheme for your Visual Studio Code editor that matches Tailwind's default color palette. This can help you stay focused and improve your coding experience by providing a familiar color scheme.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In conclusion, these are some of the must-have &lt;strong&gt;Visual Studio Code extensions&lt;/strong&gt; for &lt;strong&gt;TailwindCSS&lt;/strong&gt;. By using these extensions, you can streamline your development process and make it easier to work with TailwindCSS in Visual Studio Code. Whether you're a beginner or an experienced developer, &lt;strong&gt;these extensions can help you improve your workflow and productivity.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>extensions</category>
      <category>productivity</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
