<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammad Abad on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Abad on Medium]]></description>
        <link>https://medium.com/@dev-abad?source=rss-4ca17968a6a3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jlTOB6ZAaHsEf0jiQTIAKw.jpeg</url>
            <title>Stories by Muhammad Abad on Medium</title>
            <link>https://medium.com/@dev-abad?source=rss-4ca17968a6a3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:39:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dev-abad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[We’re Writing Fatter Code Than Ever, and RAM Will Make Us Pay for It]]></title>
            <link>https://dev-abad.medium.com/were-writing-fatter-code-than-ever-and-ram-will-make-us-pay-for-it-6f03d0a54a47?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f03d0a54a47</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Mon, 11 May 2026 18:17:51 GMT</pubDate>
            <atom:updated>2026-05-11T18:17:51.090Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>AI coding tools are a gift. But without review, they silently bloat your systems, waste memory, and pile up technical debt no one sees coming.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vW5P6XSbPEarr3IpbpgYww.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@hdbernd?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bernd 📷 Dittrich</a> on <a href="https://unsplash.com/photos/claude-code-vibe-coding-diagram-with-text-waSHO8ZEa1c?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>There’s a problem quietly growing inside a lot of modern codebases right now. At first, everything seems fine, and the feature works, tests pass, code gets approved, and it goes live. But over time, infrastructure costs start increasing, APIs become slower, servers consume more memory, and performance issues begin appearing in places nobody expected. By then, tracing the actual cause becomes much harder.</p><p>Culprit is not a library vulnerability or a bad architecture decision. It is something far more invisible: <strong>AI-generated code that no developer truly owns, understands, or has ever profiled.</strong></p><p>I want to talk about what is really happening, why it is going to get worse, and what we as developers need to do to get ahead of it before the bill arrives.</p><h3>The “Accept &amp; Move On” Culture</h3><p>AI coding assistants: GitHub Copilot, Cursor, Claude, and ChatGPT have genuinely changed how fast software gets written. Features that took days take hours.</p><p>But there is a dangerous habit forming alongside these tools: developers are <strong>accepting suggestions without truly reading them.</strong> The code looks right. It runs. Tests pass. Ship it.</p><blockquote><strong><em>The issue:</em></strong><em> AI models are trained to produce code that is </em>correct and readable<em>. They are not trained to produce code that is </em>memory-efficient, cache-aware, or suitable for your specific system’s constraints.</blockquote><p>The AI has no idea how much RAM your server has. It does not know your daily active users. It does not know that this endpoint gets called 50,000 times a minute. It writes generic, safe, readable code, and then <em>you</em> ship it at scale.</p><h3>What bloated AI code actually looks like</h3><p>Here is a real class of mistake that gets introduced constantly. You ask an AI to write a function that fetches users who posted today:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zVdOl0X2km9EN44Ysf80Lw.png" /></figure><p>The AI did not make a mistake. It wrote valid code. <strong>You made the mistake by not reviewing it.</strong></p><blockquote>“The most expensive code is the code you didn’t read before you shipped it.”</blockquote><h3>We Have Been Here Before</h3><p>Software engineering has always moved in cycles. Every generation gets access to better tools, more computing power, and higher levels of abstraction. And somewhere along the way, many of the old performance habits start fading away. Then scale hits, systems become expensive to maintain, and engineers are forced to relearn the same fundamentals.</p><p>And honestly, none of the practices I’m talking about are new. Experienced engineers have been following them for years. The difference today is that with AI-assisted development and pressure to ship faster, many teams are skipping the deeper thinking around performance, memory usage, database design, and scalability. Those fundamentals still matter and probably more now than ever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJZ4sK54LN0nhQLo2tMikw.png" /></figure><h3>1. Review AI code like a senior reviewing a junior’s PR</h3><p>When an AI writes code for you, your job has not disappeared. It has shifted. You are now the reviewer, not the author.</p><p>Ask: Does this load more data than necessary? Does this loop where it should not? Does this hold references in memory longer than needed? Treat every AI suggestion as a first draft from a smart but context-blind developer who has never profiled anything.</p><h3>2. Own your DB schema deeply</h3><p>Before you let AI generate a migration, draw the schema yourself. Understand every foreign key, every join, every access pattern.</p><p>Ask: What queries will run most often? Do I have the right indexes? Am I storing what I actually need, or a superset of it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5C6On5OTJtbqzZ6NGETTpA.png" /><figcaption>Unreviewed Generated Schema Vs. Reviewd DB Schema</figcaption></figure><h3>3. Profile before you scale</h3><p>Before adding more RAM to a server, run a memory profiler. Use clinic.js or --inspect for Node. Use memory_profiler for Python. Look at actual heap usage in production. You will almost always find that 20% of code paths are responsible for 80% of memory consumption, and most of them originated as unreviewed AI suggestions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CvTX1Fd13N8VT5bcxd0qnw.png" /></figure><blockquote><strong><em>The mindset shift:</em></strong><em> AI is powerful for generating a first draft and eliminating boilerplate. It is not a replacement for understanding what your code does. The developers who combine AI productivity with genuine systems understanding will be extraordinary. The ones who only use AI will become a liability at scale.</em></blockquote><h3>AI Is Not the Enemy. Blind Trust Is.</h3><p>I use AI coding tools every day. They save me real hours. They make me more productive. This article is not a call to stop using them.</p><p>It is a call to <strong>stay in the loop.</strong> To remember that you are the engineer. You know your system. You know your users. You know what “scale” means for your product. The AI does not.</p><p>Every time you accept a suggestion, ask yourself: <em>Do I understand every line of this? Would I have written this if I had to pay for each megabyte it consumes?</em></p><p>The fundamentals, understanding your data model, writing lean queries, knowing your memory profile, and thinking about access patterns before you write a single line, were never unimportant. We just forgot them for a few years because hardware was cheap and deadlines were brutal.</p><p>The bill is coming. It always does. The developers who stayed sharp on the basics will be the ones called in to fix what everyone else blindly shipped.</p><p><strong><em>Be one of those developers.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f03d0a54a47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dockerize a Simple Node.js + Express App from Scratch]]></title>
            <link>https://dev-abad.medium.com/dockerize-a-simple-node-js-express-app-from-scratch-dff8b4f2f7f0?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/dff8b4f2f7f0</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Sat, 19 Jul 2025 10:36:20 GMT</pubDate>
            <atom:updated>2025-07-19T10:41:25.654Z</atom:updated>
            <content:encoded><![CDATA[<p>In my experience as a software engineer, I never felt the need for Docker locally, but now the time has come. I have a codebase running on Node 8.0 with Hapi, and other projects were running on Node version 22.14. Although I was able to configure the Node version using <a href="https://github.com/nvm-sh/nvm"><strong>nvm,</strong></a> other dependencies, due to the much lower version, caused issues. I looked for another solution and planned to use Docker locally to run this specific codebase.</p><p>In this blog, I’ll walk you through the steps to set up a Node.js Express-based app using Docker, including reflecting code changes live without re-creating the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBq4aqfhSN5HiE3XXFdlBg.jpeg" /></figure><h4>Step 1: Setup Node.js App</h4><p>Create a new folder for your project:</p><pre>mkdir node-docker-demo<br>cd node-docker-demo</pre><p>Initialize a Node.js project:</p><pre>npm init -y</pre><p>Install Express:</p><pre>npm install express</pre><h4>Step 2: Create the Express App</h4><p>Create a file called index.js:</p><pre>// index.js<br>const express = require(&#39;express&#39;);<br>const app = express();<br>const port = 3000;</pre><pre>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  res.send(&#39;Hello from Muhammad Abad!&#39;);<br>});</pre><pre>app.listen(port, () =&gt; {<br>  console.log(`Server is running at <a href="http://localhost:${port}`);">http://localhost:${port}`);</a><br>});</pre><p>Update your package.json to add a start script:</p><pre>&quot;scripts&quot;: {<br>  &quot;start&quot;: &quot;node index.js&quot;<br>}</pre><h4>Step 3: Add a Dockerfile</h4><p>Create a file named Dockerfile (no extension!):</p><pre># Use an official Node.js 22 image<br>FROM node:22</pre><pre># Set the working directory<br>WORKDIR /app</pre><pre># Copy package.json and install dependencies<br>COPY package*.json ./<br>RUN npm install</pre><pre># Copy the rest of the app<br>COPY . .</pre><pre># Expose port 3000<br>EXPOSE 3000</pre><pre># Start the app<br>CMD [&quot;npm&quot;, &quot;start&quot;]</pre><h4>Step 4: Build and Run the Docker Image</h4><h4>1. Build the Docker image</h4><pre>docker build -t node-docker-demo .</pre><h4>2. Run the container</h4><pre>docker run -p 3000:3000 node-docker-demo</pre><p>You’ll see:</p><pre>Server is running at http://localhost:3000</pre><p>Visit <a href="http://localhost:3000/">http://localhost:3000</a> in your browser. You should see:</p><pre>Hello from Muhammad Abad!</pre><h4>Recommended: Auto-Reload with nodemon (For Dev)</h4><p>To avoid restarting the container every time you change code:</p><ol><li>Install nodemon:</li></ol><pre>npm install --save-dev nodemon</pre><p>2. Update package.json:</p><pre>&quot;scripts&quot;: {<br>  &quot;start&quot;: &quot;nodemon index.js&quot;<br>}</pre><ol><li>Rebuild the Docker image or mount the code with a volume:</li></ol><pre>docker run -p 3000:3000 -v $(pwd):/app node-docker-demo</pre><p>Now, code changes will trigger an automatic restart !!</p><p>Thank you for following along with the steps mentioned. I hope this blog has added some value to your knowledge.</p><p>Stay connected for more simplified blogs on upcoming topics. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dff8b4f2f7f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build REST APIs like you’ve never built them before.]]></title>
            <link>https://dev-abad.medium.com/build-rest-apis-like-youve-never-built-them-before-fc111d4d338b?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc111d4d338b</guid>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Sun, 25 May 2025 07:45:48 GMT</pubDate>
            <atom:updated>2025-05-25T07:45:48.588Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi 👋 , I’m developing variety of applications for last 7+ years and reviewing code written by fellow developers and common thing I found that most of the developers doesn’t know in actual what is REST although they claim to build REST APIs.</p><p>Overall, I found that we miss programming fundamentals and start jumping on advanced concepts. This can lead to poor practices and error-prone solutions.</p><p>Let’s simplify things and not go through with the definitions(we already read while preparing for interviews😅).</p><p>We should follow a few principles while working on APIs(REST) in any technology(e.g, Python, Node JS, PHP, Laravel, Java, Go).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67NcdFNj1y73ojvk_LWvGA.jpeg" /></figure><p><strong>Use HTTP methods:</strong> 5 methods are available for endpoints based on the definition of an endpoint/API.</p><blockquote>GET: Fetch information for any resource.</blockquote><blockquote>POST: Create/store any information for any resource.</blockquote><blockquote>PUT: Update a resource, specifically the whole body or most of the fields.</blockquote><blockquote>DELETE: Remove a resource.</blockquote><blockquote>PATCH: Update any column for any resource</blockquote><p><strong>Use Nouns for resources: </strong>Should focus on things, not on actions, e.g., an API for customer information, then we should define our endpoints like this:</p><p>GET: <em>api/customers</em> not like <em>api/get_customers</em>(wrong)</p><p>POST: <em>api/customers</em> not like <em>api/create_customers</em>(wrong)</p><p>PUT: <em>api/customers/:id</em></p><p>DELETE: <em>api/customers/:id</em></p><p>PATCH: <em>api/customers/:id</em></p><p><strong>Use appropriate HTTP methods:</strong></p><blockquote>200 OK Success: Any case where API is executing successfully.</blockquote><blockquote>201 Created: Any resource is created and inserted in database.</blockquote><blockquote>204 No Content: Success, No content to return.</blockquote><blockquote>400 Bad Request: Invalid input from client(e.g. Frontend, Mobile, Postman)</blockquote><blockquote>401 Unauthorized: Authenticated failed for the provided login credentials or header token.</blockquote><blockquote>403 Forbidden: Client is authenticated but doesn’t have permissions to access resource.</blockquote><blockquote>404 Not Found: Requested resource not found.</blockquote><blockquote>500 Internal Server Error: Something is wrong in backend code.</blockquote><p><strong>Error Handling: </strong>Proper error handling, with consistent and descriptive responses and a status code, makes it clear to the client.</p><p><strong>Validation:</strong> APIs should be validated on server-side(Backend) instead of assuming that client will validate on their end. Backend should take care of validation strongly with proper validation messages in response.</p><p><strong>Versioning: </strong>When our app goes live, we avoid modifying existing APIs directly to prevent disrupting current users. Instead, we create new endpoints for any changes or additions. Implementing API versioning helps manage these updates efficiently by keeping endpoints organized and making it easier for clients to understand and integrate with the correct version.</p><p>e.g., An API providing <strong><em>meals, and now there is some modification that will add-on ingredients and recipes as well, so now we can maintain the API.</em></strong></p><blockquote>api/v1/meals: Providing only meals for users.</blockquote><blockquote>api/v2/meals: Providing meals with add-on ingredients and recipe as well</blockquote><p>Based on my experience, these are some essential practices that should be followed across all APIs. There’s still much more that can be implemented to further improve API development. I hope that after reading this blog, anyone can better understand the true principles of REST and demonstrate them effectively through their work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc111d4d338b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Composer in Laravel: Quick tips]]></title>
            <link>https://dev-abad.medium.com/composer-in-laravel-quick-tips-9150c7d1f56c?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9150c7d1f56c</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[quick-tips]]></category>
            <category><![CDATA[knowledge]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[composer]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 01:54:16 GMT</pubDate>
            <atom:updated>2021-09-28T01:54:16.809Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*URNkDaAgy8RKJRNNA7jDaw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@moren?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">moren hsu</a> on <a href="https://unsplash.com/s/photos/minimalist?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>We are going to discuss the composer(Dependency manager), and first, I’ll give a quick difference b/w the composer install and update.</p><p>So while we run the command <strong><em>composer install</em></strong> in our terminal it checks <strong><em>composer.lock</em></strong> file and install all specific version those mentioned in the file.</p><p>And <strong><em>composer update</em></strong> checks the <strong><em>composer.</em></strong><em> </em><strong><em>json</em> </strong>file and checks the packages.org server to get any new version of mentioned packages and install them in the project.</p><p>As a result, you should run <strong><em>composer update</em></strong> on your local machine and <strong><em>composer install</em></strong> on a production server.</p><blockquote><em>If you want to go deep further in the comparison of composer install and update then you can check my another </em>article <a href="https://dev-abad.medium.com/difference-b-w-composer-install-and-update-91e4c5ab99ab">Difference between composer install and update.</a></blockquote><p>Next, let’s talk about <strong><em>— dev </em></strong>flag in the command while installing any package so simply we can use like below snippet to install the package only for development. e.g.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*3UNROlRCovEs347UEOlVeg.png" /><figcaption>E.g. To install a package with a dev flag.</figcaption></figure><p>If you check your <strong><em>composer.json </em></strong>file then you get an object with name <strong>require-dev</strong> and all dev related dependencies are mentioned there.</p><p>So if you do composer install then all dependencies will be installed but if we want to install only dev or non-dev dependencies in the project then we have to mention it manually because the composer is not a Laravel tool so can’t get it from laravel’s <strong>.env</strong> file that you are in development or production.</p><p>we can do it manually like the below snippet and it will install only required packages and remove dev-based packages as well if any are installed already.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*Wwiit3rOPChRXh0ox6o9SA.png" /><figcaption><em>commands to install or update with no dev dependencies.</em></figcaption></figure><p>We can also check outdated packages of our project and we can update them specifically if needed. we can do this by using the command:- <strong><em>composer outdated </em></strong>and it will give the list of all outdated packages with related information.</p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9150c7d1f56c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Relational schema design for LinkedIn]]></title>
            <link>https://dev-abad.medium.com/relational-schema-design-for-linkedin-a2cba31d4909?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2cba31d4909</guid>
            <category><![CDATA[schema]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[knowledge]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Mon, 13 Sep 2021 01:05:12 GMT</pubDate>
            <atom:updated>2021-09-13T01:05:12.435Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, we are going to discuss an important topic that is ignored most of the time by beginners and NoSQL background devs while developing any application or system.</p><p>As we know the database is the main part of any system if it’s not designed well then the survival of our system is not going for a long time or we have to do a lot of code or investment to make it work.</p><p>So first let’s understand the term relational schema, Relation schema defines <strong>the design and structure of the relationship</strong> like it consists of the relation name, set of attributes/field names/column names. every attribute would have an associated domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hb2YgfEHEJDYvlfqvbteDA.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@scottwebb?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Scott Webb</a> from <a href="https://www.pexels.com/photo/succulent-plant-on-gray-plant-pot-close-up-photo-305821/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>To do a designing schema for relational data store first we need to follow these steps:-</p><ol><li>List out all the features</li><li>Identify entities related to the feature.</li></ol><p>So let’s understand in a better way by doing relation schema design for LinkedIn.</p><p><strong>Note:<em> I highlighted entities in the features list and we can do in a same way.</em></strong></p><p><strong>Features of LinkedIn(Basic flow)</strong></p><blockquote>The <strong>User</strong> should be able to view or edit profile information.</blockquote><blockquote>On the top left the user should have a profile photo</blockquote><blockquote>On the right side of the profile pic, the name and contact information should be displayed.</blockquote><blockquote>Users can store or manage <strong>Skills</strong>, <strong>Education</strong>, <strong>Companies</strong>.</blockquote><blockquote>A user may send a <strong>Connection</strong> request to other users. unless the recipient approves the connection request, the sender will just be a follower. once the connection request is accepted, both sender and recipient become followers of each other.</blockquote><blockquote>A user should be able to write a <strong>Post</strong>.</blockquote><blockquote>A user should be able to <strong>Comment</strong> on a post or reply to a comment.</blockquote><blockquote>A user should be able to <strong>Like</strong> a post or a comment.</blockquote><p>We can manage user basic details in <strong>users</strong> entity with columns <strong><em>id</em></strong>, <strong><em>name</em></strong>,<strong><em> email</em></strong>, <strong><em>profile_pic</em></strong> and then we coverted feature 1 ,2 &amp; 3.</p><p>And we can see in 4th point, there are 3 functionalities are required so we have to create 3 more entities to develop these features. so we can create these entitites with one to many relationship with users entity because users can have more than one skills, companies, education.</p><p>But there is a problem as we can understand different users may have same skill, education and company so in this case data repetition will happen in these 3 entitites and it’s not good practice for any DB schema.</p><p>To resolve this problem we will create master entities for each feature like skills will be a master entity and user_skills another entity to store skills for users(<strong><em>Many to Many</em></strong>) and same as for education &amp; company.</p><p>And in above scenario there will be a relationship <strong>many to many </strong>where a single user can have multiple records(<em>skills,companies,education</em>) and a record(<em>skill,company,education</em>) can belongs to multiple users.</p><p>Let’s move on point 5th where we needs a connection feature. so to implement that simply we can create an entity <strong><em>connections.</em></strong></p><p>And connections entity contains four columns <strong><em>id</em></strong>, <strong><em>sender_user_id</em></strong>, <strong><em>receiver_user_id</em></strong>, <strong><em>is_accepted</em></strong>(bool).</p><p>where we store request sender in <strong><em>sender_user_id </em></strong>and receiver in <strong><em>receiver_user_id</em></strong> and by default the value of <strong><em>is_accepted</em></strong> will false and it will change as receiver accpets the request otherwise sender will be a follower only not a connection.</p><p>For feature 6th where we needs to maintain user posts so simply we can create an entity <strong><em>posts </em></strong>and it will contain these columns <strong><em>id</em></strong>, <strong><em>user_id</em></strong>, <strong><em>post_text </em></strong>and it will be <strong><em>one to many relationship </em></strong>in between <strong><em>users</em></strong> and <strong><em>posts</em></strong> entities because a single user can have multiple posts.</p><p>For feature 7th where we needs to develop a feature for comments on a post and to do that we will create an entity <strong><em>comments </em></strong>and these are columns <strong><em>id</em></strong>, <strong><em>user_id</em></strong>, <strong><em>post_id</em></strong>, <strong><em>comment_text </em></strong>and it will be <strong><em>one to many relationship </em></strong>in between users and posts.</p><p>And for last feature where user can like a comment or post we can do it by adding a column in related enitites and do increment as someone like that specific post or comment. But it’s not a good approach while we are developing normalized DB schema. so to handle that we will create a seperate entity <strong>likes </strong>and will manage our likes there and we need four columns there and these are <strong><em>id</em></strong>, <strong><em>user_id</em></strong>, <strong><em>entity_id</em></strong>, <strong><em>entity_type </em></strong>and simply we can do a entry in this entity as someone likes any comment or post and we can fetch likes by using aggregate function count with where condition.</p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2cba31d4909" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel 8 conditional login or signup redirects]]></title>
            <link>https://dev-abad.medium.com/laravel-8-conditional-login-or-signup-redirects-6cd3eb8f4d04?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cd3eb8f4d04</guid>
            <category><![CDATA[redirection]]></category>
            <category><![CDATA[laravel8]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[jetstream]]></category>
            <category><![CDATA[fortify]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 16:42:20 GMT</pubDate>
            <atom:updated>2021-01-27T16:42:20.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*dhiHGTupduBicbYHayaYTQ.png" /></figure><p>Laravel 8 introduces <a href="https://github.com/laravel/fortify">Fortify</a>, a new back-end package for providing user authentication. This represents a big departure from the <strong>controller with traits</strong> approach used in previous versions and has caused some concern that the authentication process is no longer customizable.</p><p>I used fortify in a project and want to redirect the user to a custom route, not on home as default. So unfortunately there is no option in <a href="https://github.com/laravel/fortify">Fortify</a> documentation to do it. But we can do it by hooks that we require are bound into the container during the booting of the Laravel\Fortify\FortifyServiceProvider.</p><p>Within our own code, we can re-bind a different class where we will place our business logic.</p><h3>Create our own Login Response Class</h3><ol><li>Create a folder under app\Http called Responses</li><li>Create a file LoginResponse.php</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*WA4FV_o2oBdlfCX-dIMGRQ.png" /></figure><p>Simply, we need to change only in the intended() and we can put here our own route as I did in the below code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*DDemj9iTLqJ9QboX8CSOOg.png" /></figure><p>This new class now replaces the Singleton previously registered by Fortify.</p><p>Edit the JetstreamServiceProvider orFortifyServiceProvider in your app\Providers folder;</p><p>In the boot method, add a reference to your new response class. When login completes (and the user is actually Authenticated) then your new response will be called.</p><p>Need to add below code of snippet in the boot method of app\Providers\FortifyServiceProvider.php file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*Y9FGqM7OUKl7RwrGaLErMQ.png" /></figure><p>Same we can do to manage after registereration redirection.</p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cd3eb8f4d04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fortify implementation with Laravel 8]]></title>
            <link>https://dev-abad.medium.com/fortify-implementation-with-laravel-8-851a1a2ff117?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/851a1a2ff117</guid>
            <category><![CDATA[fortify]]></category>
            <category><![CDATA[laravel-authentication]]></category>
            <category><![CDATA[laravel8]]></category>
            <category><![CDATA[jetstream]]></category>
            <category><![CDATA[laravel-ui]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Wed, 04 Nov 2020 13:02:32 GMT</pubDate>
            <atom:updated>2020-11-04T13:06:22.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*6Mt9OeC-AGNzvI7A9Y45rw.png" /></figure><p>In the latest release of Laravel, they recommended <a href="https://jetstream.laravel.com/">Jetstream</a> to make application scaffolding but as we used <a href="https://github.com/laravel/ui">laravel UI</a> in our previous laravel applications so we may want to use the same thing in further projects as well.</p><p>But Laravel 8 recommends Jetstream and in the initial days of laravel 8 release, they also mentioned that Laravel UI will not support anymore for Laravel 8 but after a lot of discussions and comments by Laravel Community the Laravel UI started support to Laravel 8. But we should play the safer side and maybe in Laravel 9 or 10 they again stopped support for Laravel UI so we should use something latest and officially recommended things.</p><p>Here comes <a href="https://jetstream.laravel.com/">Jetstream</a>(<em>Laravel Jetstream is a beautifully designed application scaffolding for Laravel. Jetstream provides the perfect starting point for your next Laravel application and includes login, registration, email verification, two-factor authentication, session management, API support via </em><a href="https://github.com/laravel/sanctum"><em>Laravel Sanctum</em></a><em>, and optional team management</em>.) but there is a problem with it for beginners or some developers because it comes with two types of scaffolding one is <a href="https://laravel-livewire.com/">Livewire</a> and another one is <a href="https://vuejs.org/">Vue</a>. So who don’t want to learn or implement any new stack then what they do? So <a href="https://jetstream.laravel.com/1.x/features/authentication.html#laravel-fortify">Fortify</a> comes in the role and it’s also provided by Jetstream officially.</p><p>Laravel Fortify is a frontend agnostic authentication backend for Laravel. Fortify powers the registration, authentication, and two-factor authentication features of <a href="https://github.com/laravel/jetstream">Laravel Jetstream</a>.</p><p>You may use Fortify (without Jetstream) to serve a headless authentication backend for your Laravel application. And can use your custom UI whatever you want or will show here to use Auth UI provided by Laravel UI.</p><p>So here we show how to use Fortify in our new applications based on Laravel 8.</p><p>To get started, install Fortify using Composer:</p><pre>composer require laravel/fortify</pre><p>Next, publish Fortify’s resources:</p><pre>php artisan vendor:publish --provider=&quot;Laravel\Fortify\FortifyServiceProvider&quot;</pre><p>Next, Connect with fresh DB and migrate your database:</p><pre>php artisan migrate</pre><p>Fortify Setup is done now we have to enable Fortify features from the file fortify.php(config/fortify.php). The fortify the configuration file contains a features configuration array.</p><p>We can easily comment or uncomment features as per our project’s requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mAPHDZK7MwJEu9dWi-AjWg.png" /><figcaption>Fortify Features Array</figcaption></figure><p>To get started, we need to instruct Fortify on how to return our login view. Remember, Fortify is a headless authentication library. All of the authentication view’s rendering logic may be customized using the appropriate methods available via the Laravel\Fortify\Fortify class. Typically, you should call this method from the boot method of your FortifyServiceProvider (app\Providers\FortifyServiceProvider.php)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fX6uGJB2xAN593nAznNHww.png" /></figure><p>Fortify will take care of generating the /login route that returns this view. Your login template should include a form that makes a POST request to /login. The /login action expects a string email address / username and a password. The name of the email / username field should match the username value of the fortify configuration file.</p><p>So we have done backend setup in Fortify now we can use our custom UI that’s under our project’s theme But if we want to use laravel UI’s Auth Screens as we mentioned above so we have to do a simple thing and need to generate a fresh laravel project and install <a href="https://github.com/laravel/ui">laravel UI</a>. And take copy auth &amp; layouts folders from <strong>resources/views </strong>and paste in your new project’s directory and run your project in the browser you will get same login &amp; signup screens as you get in laravel UI scaffolding.</p><p>This is the basics of Fortify to use in our Laravel Projects, but you should go deeper by exploring official docs.</p><p><a href="https://jetstream.laravel.com/1.x/features/authentication.html#laravel-fortify">https://jetstream.laravel.com/1.x/features/authentication.html#laravel-fortify</a></p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=851a1a2ff117" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create & Use Components in Laravel 8]]></title>
            <link>https://dev-abad.medium.com/how-to-create-use-components-in-laravel-8-c00e30a5b63e?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c00e30a5b63e</guid>
            <category><![CDATA[laravel-blade]]></category>
            <category><![CDATA[react-components]]></category>
            <category><![CDATA[laravel8]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[blade]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Wed, 16 Sep 2020 04:56:35 GMT</pubDate>
            <atom:updated>2020-09-16T05:03:12.496Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rvw-QLt6yKSZTy6EgpZPvg.png" /></figure><p>There are a lot of new features in L8 but we are going to discuss a feature that is not adopted by most of the devs and it’s cool addition in Laravel and best to use in time-saving and escape the repetition of code.</p><p>First, we will discuss a scenario where we can use or where we should use the component in our Laravel project. e.g. I am developing a Job Portal where I need a wishlist feature and there will be a UI that needs to render on different screens to show wishlist Jobs to the user. So I have an HTML for that and I am writing the code on each page where I need to show wishlist and it’s as usual in Laravel projects. But if we create a component to render the wishlist HTML then it will save a lot of repetition and time.</p><p>Finally, I created a component by using a command.</p><pre>php artisan make:component Wishlist</pre><p>And this command provides me a View in resources/views/components/wishlist.blade.php and a PHP file in app/View/Components/Wishlist.php.</p><p>Where I wrote my wishlist HTML in the blade file and some PHP code in the PHP file.</p><p>Once your component has been generated, it may be rendered using its name:&lt;x-wishlist/&gt;</p><p>We can also pass variables in the component via attributes that are prefixed with :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*S9gplocISTLryZQIcsVkBg.png" /></figure><p>You have to define the component’s required data in its class constructor(In Provided PHP FILE). All public properties on a component will automatically be made available to the component’s view. It is not necessary to pass the data to the view from the component’s render method But if you using the component in a loop then have to pass data in the render method as well.</p><p>e.g:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4LyLJBpOlRw3Q_ptHBReGw.png" /></figure><blockquote>And in the component’s blade file we can access variables using blade expression.{{$Job-&gt;title}}</blockquote><p>This is the basic usage of components that we can use in our Laravel Projects, but you should go deeper by exploring official docs.</p><p>URL:- <a href="https://laravel.com/docs/8.x/blade#components">https://laravel.com/docs/8.x/blade#components</a></p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c00e30a5b63e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference b/w Composer install and update.]]></title>
            <link>https://dev-abad.medium.com/difference-b-w-composer-install-and-update-91e4c5ab99ab?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/91e4c5ab99ab</guid>
            <category><![CDATA[composer-install]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[composer]]></category>
            <category><![CDATA[codeigniter]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 12:32:54 GMT</pubDate>
            <atom:updated>2020-09-10T12:32:54.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*aLxvCxu7EYNeMpZ5h57yCg.jpeg" /></figure><p>This is a common question that asked by newbie PHP devs. and it’s also important as well.</p><p>composer update will update your dependencies as they are specified in composer.json</p><p>For example, if you require this package as a dependency:</p><pre>&quot;guzzlehttp/guzzle&quot;: &quot;6.3.*&quot;,</pre><p>and you have actually installed the 6.3.1 version of this package, running composer update will cause an upgrade of this package (for example to 6.3.2, if it&#39;s already been released)</p><p>in detail composer update will:</p><ul><li>Read composer.json</li><li>Remove installed packages that are no more required in composer.json</li><li>Check the availability of the latest versions of your required packages</li><li>Install the latest versions of your packages</li><li>Update composer.lock to store the version of the installed package</li></ul><p><strong>composer install</strong></p><p>composer install will not update anything; it will just install all the dependencies as specified in the composer.lock file</p><p>In detail:</p><ul><li>Check if composer.lock file exists (if not, run composer-update and create it)</li><li>Read composer.lock file</li><li>Install the packages specified in the composer.lock file</li></ul><p><strong>When to install and when to update</strong></p><ul><li>composer update is mostly used in the &#39;development phase&#39;, to upgrade our project packages according to what we have specified in the composer.json file,</li><li>composer install is primarily used in the &#39;deploying phase&#39; to install our application on a production server or on a testing environment, using the same dependencies stored in the composer.lock file created by the composer update.</li></ul><p>So these are the overall differentiation b/w composer update and install.</p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91e4c5ab99ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A quick way to change Password encryption method in Laravel 7]]></title>
            <link>https://dev-abad.medium.com/a-quick-way-to-change-password-encryption-method-in-laravel-7-4925151b1b9?source=rss-4ca17968a6a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4925151b1b9</guid>
            <category><![CDATA[laravel-auth]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[laravel-authentication]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[password-encryption]]></category>
            <dc:creator><![CDATA[Muhammad Abad]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 10:49:18 GMT</pubDate>
            <atom:updated>2020-07-12T08:13:36.148Z</atom:updated>
            <content:encoded><![CDATA[<p>We are going to change Laravel’s Default encryption method for login and register. And what Laravel says about the authentication, The Laravel <strong>Hash</strong> facade provides secure <strong>Bcrypt</strong> and Argon2 <strong>hashing</strong> for storing user passwords. If you are using the built-in LoginController and RegisterController classes that are included with your Laravel application, they will use <strong>Bcrypt</strong> for registration and authentication by default. (<em>Laravel Official</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*K5JOQos4KvwzzslfkSgWIA.jpeg" /></figure><p>So first we need to change in RegisterController.php file. You will see a method <em>create</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*UkrosJSIPnMvHi3Q5cXDMw.png" /></figure><p>And We have to add a function to provide a converted password or we can also write conversion code in the above method but we should use the function for each and every task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*HcU-HOIujZd6J1wAUF5x6w.png" /></figure><p>Here we need to pass a string to this method and it will return an encrypted password and here we are using our own custom conversion as you can see.</p><p>So it’s done for the registration but now we have to do a little bit tricky thing to make it workable at the time of login.</p><p>So let’s deep dive into LoginController.php file and you will see a trait that is used by Laravel Framework to make authentication workable. And we need to change in AuthenticateUsers.php(<strong><em>trait class</em></strong>) file.</p><p>You will see a method with name attemptlogin()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*It9FzN6Dl1exXp5oSe2yGA.png" /></figure><p>And we are going to modify this one to make our login workable for stored encrypted passwords. Now we need to comment/remove the above snippet and write these lines of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*IfALjdaz7_fF9KsFBV7L_w.png" /></figure><p>And this is done now you can register and log in without following laravel’s encryption!</p><p><strong>Before you go…</strong> Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking the 👏 below!</p><p>I write about my professional experiences as a self-taught software developer, so click the <strong>follow</strong> button if this interests you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4925151b1b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>