<?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: saeedeldeeb</title>
    <description>The latest articles on DEV Community by saeedeldeeb (@saeedeldeeb).</description>
    <link>https://dev.to/saeedeldeeb</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%2F600551%2F24cdfe16-e5a8-476b-bb50-6ca5f1e92fa3.jpeg</url>
      <title>DEV Community: saeedeldeeb</title>
      <link>https://dev.to/saeedeldeeb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saeedeldeeb"/>
    <language>en</language>
    <item>
      <title>Efficient PostgreSQL Database Backup and Restoration with pg_dump and pg_restore</title>
      <dc:creator>saeedeldeeb</dc:creator>
      <pubDate>Thu, 24 Aug 2023 09:40:51 +0000</pubDate>
      <link>https://dev.to/saeedeldeeb/efficient-postgresql-database-backup-and-restoration-with-pgdump-and-pgrestore-438n</link>
      <guid>https://dev.to/saeedeldeeb/efficient-postgresql-database-backup-and-restoration-with-pgdump-and-pgrestore-438n</guid>
      <description>&lt;p&gt;In the world of database management, the ability to secure and swiftly restore data is paramount. PostgreSQL, a powerful open-source relational database management system, equips us with tools like &lt;code&gt;pg_dump&lt;/code&gt; and &lt;code&gt;pg_restore&lt;/code&gt; to ensure data integrity and efficient recovery. In this article, we will explore the seamless process of exporting and importing PostgreSQL databases using these utilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exporting Data with pg_dump
&lt;/h2&gt;

&lt;p&gt;To back up your PostgreSQL database, the &lt;code&gt;pg_dump&lt;/code&gt; command comes to the rescue. This versatile tool allows you to create a comprehensive backup of your database, encompassing its structure and data. Here's how you can use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; postgresql pg_dump &lt;span class="nt"&gt;--username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-user &lt;span class="nt"&gt;--dbname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-db &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5478 &lt;span class="nt"&gt;-F&lt;/span&gt; c &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /path/to/database/file.dump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break down the command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker exec -i postgresql&lt;/code&gt;: Executes a command within the Docker container named &lt;code&gt;postgresql&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pg_dump&lt;/code&gt;: Initiates the backup process.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--username=your-user&lt;/code&gt;: Specifies the username for database access.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--dbname=your-db&lt;/code&gt;: Specifies the name of the target database.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--port=5478&lt;/code&gt;: Specifies the port number for database connection.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-F c&lt;/code&gt;: Specifies the custom format for the backup.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;gt; /path/to/database/file.dump&lt;/code&gt;: Redirects the backup output to a file named &lt;code&gt;file.dump&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Importing Data with pg_restore
&lt;/h2&gt;

&lt;p&gt;When it's time to restore your backup, &lt;code&gt;pg_restore&lt;/code&gt; is your go-to utility. It efficiently brings back your database to life using the backup file created with &lt;code&gt;pg_dump&lt;/code&gt;. The process is seamless:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; postgresql pg_restore &lt;span class="nt"&gt;--username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-user &lt;span class="nt"&gt;--dbname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-db &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5478 &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt; c &amp;lt; /path/to/database/file.dump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breaking down the command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--username=your-user&lt;/code&gt;, &lt;code&gt;--dbname=your-db&lt;/code&gt;, and &lt;code&gt;--port=5478&lt;/code&gt; specify the same connection details used during backup.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-c&lt;/code&gt; cleans the existing database content before restoration.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-F c&lt;/code&gt; indicates that the format of the input is custom.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt; //path/to/database/file.dump&lt;/code&gt; provides the backup file as input for the restoration process.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Advantage of pg_restore
&lt;/h2&gt;

&lt;p&gt;While both &lt;code&gt;psql&lt;/code&gt; and &lt;code&gt;pg_restore&lt;/code&gt; can restore &lt;code&gt;.sql&lt;/code&gt; files, &lt;code&gt;pg_restore&lt;/code&gt; boasts a substantial speed advantage. It is optimized to process backups efficiently, making it particularly advantageous for restoring large databases. Additionally, the use of &lt;code&gt;.dump&lt;/code&gt; files results in significantly smaller backup sizes, saving storage space without compromising on data integrity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seamless Continuation on Interruption
&lt;/h2&gt;

&lt;p&gt;One of the major benefits of &lt;code&gt;pg_restore&lt;/code&gt; is its resilience in case of interruption. If the import process is interrupted for any reason, &lt;code&gt;pg_restore&lt;/code&gt; can pick up from where it left off, ensuring that no data is lost and the restoration is completed without hassle.&lt;/p&gt;

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

&lt;p&gt;In the realm of PostgreSQL database management, the combination of &lt;code&gt;pg_dump&lt;/code&gt; and &lt;code&gt;pg_restore&lt;/code&gt; offers a robust solution for secure backup and swift restoration. By leveraging these utilities, you can safeguard your data and restore it with unparalleled efficiency. The speed advantage and compact &lt;code&gt;.dump&lt;/code&gt; file format make &lt;code&gt;pg_restore&lt;/code&gt; the preferred choice for a seamless and streamlined database recovery process.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Power of Rsync: Efficient File Synchronization for Linux</title>
      <dc:creator>saeedeldeeb</dc:creator>
      <pubDate>Tue, 25 Jul 2023 00:07:08 +0000</pubDate>
      <link>https://dev.to/saeedeldeeb/the-power-of-rsync-efficient-file-synchronization-for-linux-46ho</link>
      <guid>https://dev.to/saeedeldeeb/the-power-of-rsync-efficient-file-synchronization-for-linux-46ho</guid>
      <description>&lt;p&gt;Rsync is a powerful utility for file synchronization in Linux that allows you to efficiently copy and synchronize files between local and remote locations. In this article, we'll explore some of the most commonly used rsync commands and their practical applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic File Copying
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Copy a File from Source to Destination:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To copy a single file from the source to the destination, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync source/photos.zip destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Copy a Folder Recursively:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To copy a folder and its contents recursively, use the &lt;code&gt;-r&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -r source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Copy Files with Timestamp Preservation:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;-a&lt;/code&gt; option (archive mode) preserves file permissions, timestamps, and more during the copy operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -a source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Monitoring Progress
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;List Copying Progress:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a more verbose output that lists the files being copied and the progress, use the &lt;code&gt;-v&lt;/code&gt; (verbose) option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -av source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, use the &lt;code&gt;--progress&lt;/code&gt; option for a human-readable progress indicator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -a --progress source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Human-Readable Progress:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a human-readable progress display, add the &lt;code&gt;-h&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -ah --progress source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Handling Interruptions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Partial Copies for Large Files:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When dealing with large files, use the &lt;code&gt;--partial&lt;/code&gt; option to allow for partial copies. This enables you to resume interrupted transfers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -ah --progress --partial source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, the &lt;code&gt;-P&lt;/code&gt; option is a shorthand for &lt;code&gt;--partial --progress&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Synchronization
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Syncing with Deletion:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To sync files and delete items in the destination that no longer exist in the source, add the &lt;code&gt;--delete&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -ahP --delete source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Remove Source Files after Successful Copy:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To automatically delete files from the source after a successful copy, use the &lt;code&gt;--remove-source-files&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -ahP --remove-source-files source/ destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: This won't delete source folders, so an additional step is required, you can use &lt;code&gt;$ find like -type d -empty -delete&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Remote Synchronization
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Synchronizing with a Remote Server:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To sync files from a local machine to a remote server, use the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   $ rsync -ahP source root@your.ip:path/to/folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Archiving Before Sync:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Archiving can be useful to preserve attributes and reduce the amount of data transferred. To archive a remote folder before syncing, use:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rsync -ahPz root@your.ip:path/to/folder source/
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;If the SSH port is non-default (e.g., 22), specify it using the &lt;code&gt;-e&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rsync -ahPze 'ssh -p 22' root@your.ip:path/to/folder source/
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rsync is a tool for efficiently managing file synchronization tasks on Linux systems. With its flexibility and numerous options, it empowers users to handle a wide range of data synchronization requirements with ease.&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Connect One keyboard and mouse with multiple Laptops</title>
      <dc:creator>saeedeldeeb</dc:creator>
      <pubDate>Sat, 22 Jul 2023 11:01:48 +0000</pubDate>
      <link>https://dev.to/saeedeldeeb/connect-one-keyboard-and-mouse-with-multiple-laptops-17ej</link>
      <guid>https://dev.to/saeedeldeeb/connect-one-keyboard-and-mouse-with-multiple-laptops-17ej</guid>
      <description>&lt;p&gt;&lt;strong&gt;Barrier&lt;/strong&gt; is a part-open source application that allows multiple computers to share a single keyboard and mouse set. This allows you to have multiple computers attached to separate monitors, all of which can be worked on with only one set of peripherals. &lt;strong&gt;Barrier&lt;/strong&gt; works by running a server on the computer that the keyboard and mouse are connected to. This server then talks to clients that are installed on the other computers via SSH.&lt;br&gt;
&lt;strong&gt;Barrier&lt;/strong&gt; is working across different Operating Systems (MacOS, Linux, Windows) so you can download it very easily using &lt;code&gt;.exe&lt;/code&gt; for windows and &lt;code&gt;.dmg&lt;/code&gt; for mac and &lt;code&gt;command line&lt;/code&gt; in linux.&lt;br&gt;
Download from this &lt;a href="https://github.com/debauchee/barrier/releases" rel="noopener noreferrer"&gt;link&lt;/a&gt; &lt;br&gt;
And from command line ubuntu&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt -y install barrier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fblog.delevingne.me%2Fwp-content%2Fuploads%2F2018%2F08%2Fusing-barrier-001.png%3Fw%3D616%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fblog.delevingne.me%2Fwp-content%2Fuploads%2F2018%2F08%2Fusing-barrier-001.png%3Fw%3D616%26ssl%3D1" alt="Barrier running on my Windows computer."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I took the IP from server to client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fblog.delevingne.me%2Fwp-content%2Fuploads%2F2018%2F08%2Fusing-barrier-002.png%3Fresize%3D768%252C444%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fblog.delevingne.me%2Fwp-content%2Fuploads%2F2018%2F08%2Fusing-barrier-002.png%3Fresize%3D768%252C444%26ssl%3D1" alt="My Ubuntu Barrier client, displaying it’s status and connection configuration."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Maybe you would face this error &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ssl certificate doesn't exist: /path/to/SSL/Barrier.pem&lt;br&gt;
We need to install openssl within our server and client, so on &lt;strong&gt;windows:&lt;/strong&gt; &lt;br&gt;
From CMD &lt;code&gt;winget install openssl&lt;/code&gt; or download it.&lt;br&gt;
On &lt;strong&gt;linux:&lt;/strong&gt;&lt;br&gt;
From terminal &lt;code&gt;sudo apt update&lt;br&gt;
sudo apt update&lt;br&gt;
openssl version&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then on both Operating Systems&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd  "path to your SSL"
mkdir -p Fingerprints
openssl req -x509 -nodes -days 365 -subj /CN=barrier -newkey rsa:4096 -keyout Barrier.pem -out Barrier.pem
openssl x509 -fingerprint -sha256 -noout -in Barrier.pem &amp;gt; Fingerprints/Local.txt
sed -e "s/.*=/v2:sha256:/" -i Fingerprints/Local.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then restart your Barriers &lt;/p&gt;

</description>
      <category>barrier</category>
    </item>
    <item>
      <title>Laravel 9, what's new?!</title>
      <dc:creator>saeedeldeeb</dc:creator>
      <pubDate>Mon, 21 Feb 2022 13:07:00 +0000</pubDate>
      <link>https://dev.to/saeedeldeeb/laravel-9-whats-new-26g</link>
      <guid>https://dev.to/saeedeldeeb/laravel-9-whats-new-26g</guid>
      <description>&lt;p&gt;Laravel and its other first-party packages follow Semantic Versioning. Major framework releases are released every year (~February), while minor and patch releases may be released as often as every week. Minor and patch releases should never contain breaking changes.&lt;/p&gt;

&lt;p&gt;When referencing the Laravel framework or its components from your application or package, you should always use a version constraint such as ^9.0, since major releases of Laravel do include breaking changes. However, we strive to always ensure you may update to a new major release in one day or less.&lt;/p&gt;




&lt;h2&gt;
  
  
  From 8.x to 9.x important changes:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  php is beginning transition to require function return type.&lt;/li&gt;
&lt;li&gt;  Belongs to many methods (&lt;code&gt;firstOr...&lt;/code&gt;,  &lt;code&gt;UpdateOr...&lt;/code&gt;) now comparing against the related model not pivot.&lt;/li&gt;
&lt;li&gt;  They moved from  &lt;code&gt;swiftMailer&lt;/code&gt;  to  &lt;code&gt;symfonyMailer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  lang directory have located to project root directory.&lt;/li&gt;
&lt;li&gt;  Use  &lt;code&gt;current_password&lt;/code&gt;  validation rule instead of  &lt;code&gt;password&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  New features in 9.x:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Route controller group.&lt;/li&gt;
&lt;li&gt;Anonymous migration class.&lt;/li&gt;
&lt;li&gt;New helper functions.&lt;/li&gt;
&lt;li&gt;Refreshed ignition error page.&lt;/li&gt;
&lt;li&gt;Render blade string.&lt;/li&gt;
&lt;li&gt;Forced scope bindings.&lt;/li&gt;
&lt;li&gt;Laravel scout DB engine.&lt;/li&gt;
&lt;li&gt;Full text indexing.&lt;/li&gt;
&lt;li&gt;Enum attribute casting.&lt;/li&gt;
&lt;li&gt;Simplified accessors and mutators.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;we will discuss every point below:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Route controller group
&lt;/h3&gt;

&lt;p&gt;If a group of routes all utilize the same &lt;a href="https://laravel.com/docs/9.x/controllers"&gt;controller&lt;/a&gt;, you may use the &lt;code&gt;controller&lt;/code&gt; method to define the common controller for all of the routes within the group. Then, when defining the routes, you only need to provide the controller method that they invoke:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use App\Http\Controllers\OrderController;

Route::controller(OrderController::class)-&amp;gt;group(function  () {
Route::get('/orders/{id}', 'show');
Route::post('/orders', 'store');
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;They don't stop here but also made new console format when listing&lt;br&gt;
project routes &lt;code&gt;php artisan route:list&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v1UuIFn5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/5457236/148321982-38c8b869-f188-4f42-a3cc-a03451d5216c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v1UuIFn5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/5457236/148321982-38c8b869-f188-4f42-a3cc-a03451d5216c.png" alt="enter image description here" width="880" height="309"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Anonymous migration class
&lt;/h3&gt;

&lt;p&gt;Migration file now not class with name but anonymous one.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
...
return  new  class  extends  Migration
{
    /**
    * Run the migrations.
    *
    * @return  void
    */
    public  function  up()
    {
    ...
    });
}

    /**
    * Reverse the migrations.
    *
    * @return  void
    */
    public  function  down()
    {
    ...
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  New helper functions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;str('__') /** equals to */ Str::of('__');&lt;/code&gt;
and it's good specially in blade as we don't need to use name space qualifier of Str class.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;to_route('__'); /** equals to */ redirect()-&amp;gt;route('__');&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Refreshed ignition error page
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DtclKnkb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://freek.dev/uploads/media/ignition-2022/ignition.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DtclKnkb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://freek.dev/uploads/media/ignition-2022/ignition.png" alt="enter image description here" width="880" height="572"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Render blade string
&lt;/h3&gt;

&lt;p&gt;Sometimes you may need to transform a raw Blade template string into valid HTML.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Illuminate\Support\Facades\Blade;

return  Blade::render('Hello, @if(true) {$name} @endif', ['name'  =&amp;gt;  'Julian Bashir']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  Forced scope bindings
&lt;/h3&gt;

&lt;p&gt;To bind models only belong to another model.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('/users/{user}/posts/{post:id}', function(User $user, Post $post){
...
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;we use &lt;code&gt;post:id&lt;/code&gt; to see if user has this post , if not returns 404 but this can be dis-informative so explicitly:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('/users/{user}/posts/{post}', function(User $user, Post $post){
    ...
    })-&amp;gt;scopeBindings();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  Laravel scout DB engine
&lt;/h3&gt;

&lt;p&gt;Scout package performs full text search, It used to using services but now for small projects we can use our DB engine.&lt;/p&gt;




&lt;h3&gt;
  
  
  Full text indexing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In migration class:
&lt;code&gt;$table-&amp;gt;text('body')-&amp;gt;fullText();&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;When searching:
&lt;code&gt;Post::whereFullText('body', '__')-&amp;gt;get();&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Enum attribute casting
&lt;/h3&gt;

&lt;p&gt;Eloquent also allows you to cast your attribute values to PHP &lt;a href="https://www.php.net/manual/en/language.enumerations.backed.php"&gt;"backed" enums&lt;/a&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use App\Enums\ServerStatus;

/**
* The attributes that should be cast.
*
* @var  array
*/
protected  $casts  = [
'status'  =&amp;gt;  ServerStatus::class,
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;also Laravel allows you to type-hint an Enum on your route definition and Laravel will only invoke the route if that route segment corresponds to a valid Enum value. Otherwise, a 404 HTTP response will be returned automatically.&lt;/p&gt;

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

namespace App\Enums;

enum  Category:  string 
{
    case  Fruits  =  'fruits';    
    case  People  =  'people';    
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use App\Enums\Category;
use Illuminate\Support\Facades\Route;

Route::get('/categories/{category}', function  (Category  $category) {
    return  $category-&amp;gt;value;    
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h3&gt;
  
  
  Simplified accessors and mutators
&lt;/h3&gt;

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

namespace App\Models;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;

class  User  extends  Model    
{    
    /**    
    * Interact with the user's first name.    
    *    
    * @param  string $value    
    * @return  \Illuminate\Database\Eloquent\Casts\Attribute    
    */    
    protected  function  firstName():  Attribute
    {    
        return  new  Attribute(    
        get: fn  ($value) =&amp;gt; ucfirst($value),    
        set: fn  ($value) =&amp;gt; strtolower($value),    
         );    
    }    
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>php</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Laravel Sail</title>
      <dc:creator>saeedeldeeb</dc:creator>
      <pubDate>Sun, 15 Aug 2021 14:51:20 +0000</pubDate>
      <link>https://dev.to/saeedeldeeb/laravel-sail-2ndo</link>
      <guid>https://dev.to/saeedeldeeb/laravel-sail-2ndo</guid>
      <description>&lt;p&gt;As mentioned in sail docs:&lt;br&gt;
Laravel Sail is a light-weight command-line interface for interacting with Laravel's default Docker development environment. Sail provides a great starting point for building a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience.&lt;/p&gt;

&lt;p&gt;Steps to install Laravel Sail on your machine:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  1. Install Laravel using curl command from laravel builder:
       curl -s https://laravel.build/your-app-name | bash
       you can change your-app-name in the link.

 2. Move to the project directory:
       cd your-app-name

 3. To up your container 
       /vendor/bin/sail up -&amp;gt; this may take several minutes.

 4. Now you can see your App running on: 
       http://localhost.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>laravel</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
