<?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 Marie Mbenoun on Medium]]></title>
        <description><![CDATA[Stories by Marie Mbenoun on Medium]]></description>
        <link>https://medium.com/@emymbenoun?source=rss-cfafb589c824------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aA5qCO90G0QecW-W.</url>
            <title>Stories by Marie Mbenoun on Medium</title>
            <link>https://medium.com/@emymbenoun?source=rss-cfafb589c824------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:18:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emymbenoun/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[A handful list of resources for web developers]]></title>
            <link>https://blog.devgenius.io/a-handful-list-of-resources-for-web-developers-92f25d43aa04?source=rss-cfafb589c824------2</link>
            <guid isPermaLink="false">https://medium.com/p/92f25d43aa04</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[back-end-development]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Marie Mbenoun]]></dc:creator>
            <pubDate>Sun, 14 Feb 2021 14:17:17 GMT</pubDate>
            <atom:updated>2021-02-15T08:19:02.268Z</atom:updated>
            <content:encoded><![CDATA[<h4>A collection of online tools for the different hats you can put on as a web developer</h4><figure><img alt="A lamp turned on — and a list of the topics we are going to discuss in the article" src="https://cdn-images-1.medium.com/max/1024/1*ew5s27fYGlEov0hHNqL0XA.jpeg" /><figcaption>Background image by <a href="https://unsplash.com/@dvandijk">David van Dijk</a> on Unsplash</figcaption></figure><p>As a developer, it can be a struggle at times to find the right tool to help you accomplish a particular task. Find below a compiled list of some tools that I have used or come across and that can help boost your development process or spark some creativity in your work.</p><h3>Coding</h3><h4><a href="https://carbon.now.sh/">Carbon App</a></h4><figure><img alt="Testing Carbon.now.sh — generating a beautiful snippet of our code" src="https://cdn-images-1.medium.com/max/1024/1*udP8Xp62nk-YDyzkDAvu9g.png" /><figcaption>Image by the Author. Source: <a href="https://carbon.now.sh/">https://carbon.now.sh/</a></figcaption></figure><figure><img alt="Code snippet exported from Carbon.now.sh" src="https://cdn-images-1.medium.com/max/1024/1*eYwu7e0MyxZbRlD_KD225g.png" /><figcaption>Exported image from carbon.now.sh</figcaption></figure><p>With <a href="https://carbon.now.sh/"><strong>Carbon</strong></a>, sharing your code snippets has never been easier! This tool allows you to create and share beautiful images of your code. You can customize the look and feel of the snippet by changing the theme, the font, the background, and more! When you are done, you can export the file as a PNG or SVG file.</p><p>✨ Alternative: <a href="https://codekeep.io/screenshot">Codekeep.io</a></p><h4><a href="https://crontab.guru/">Crontab Guru</a></h4><figure><img alt="An overview of crontab guru, showing an example of a Cron schedule expression" src="https://cdn-images-1.medium.com/max/1024/1*2z0SJpzARkijnyDiWOFrjg.png" /><figcaption>Image by the Author. Source: <a href="https://crontab.guru/">https://crontab.guru/</a></figcaption></figure><p>Simply put, Cron jobs are commands set up to run at specific times. They are most commonly used to schedule tasks that are meant to run periodically without human intervention. Examples would be: sending out batch invoices to clients every 1st of the month at 6AM, backing up log data every afternoon, sending reminders, or checking for updates.</p><p><strong>Crontab Guru</strong> is a free editor that allows you to edit crontab schedule expressions and see when next they will run. You can easily test simple or complex expressions to automate your tasks.</p><p>For instance, with <a href="https://laravel.com/docs/8.x/scheduling#schedule-frequency-options">Laravel</a>, you can specify the frequency of a Cron job using the cron() method like this:</p><figure><img alt="A sample usage of a Cron schedule expression with Laravel" src="https://cdn-images-1.medium.com/max/662/1*QvOT8wpk5UafWoV2Hzqtbw.png" /><figcaption>Image by the Author. Generated using Carbon.now.sh</figcaption></figure><h4><a href="https://stackedit.io/">StackEdit</a></h4><figure><img alt="A screenshot of Stack Edit, an online markdown editor" src="https://cdn-images-1.medium.com/max/1024/1*9H0Dgxxf02Gq8jrMSv02SA.png" /><figcaption>Image by the author. Src: <a href="https://stackedit.io/app#">https://stackedit.io/app#</a></figcaption></figure><p>StackEdit is an open-source markdown editor. Its easy-to-use interface allows you to format your lists, headers, links, and images, and text. It integrates with other Markdown extensions, for extra nice features, like rendering mathematical expressions or displaying UML diagrams. You can use StackEdit to create and preview your project’s README.md file before pushing it to a source control platform like Github.</p><h4><a href="https://gitexplorer.com/">Git Explorer</a></h4><figure><img alt="A screenshot of Git explorer, a platform to lookup all GIT expressions" src="https://cdn-images-1.medium.com/max/1024/1*pXO0oWpJ8e4N1FyqIxINXg.png" /><figcaption>Image by the Author. Source: <a href="https://gitexplorer.com/">https://gitexplorer.com/</a></figcaption></figure><p>If you ever find yourself regularly googling Git commands, then this tool is for you. With Git explorer, you can easily look up all GIT commands in one place. It offers a visual cheat sheet of common GIT expressions, all in a beautifully designed interface.</p><p>📄 <strong>Note:</strong> <strong>If you want to learn more about GIT version control, check out the following awesome resources: </strong><a href="https://learngitbranching.js.org/"><strong>Learn Git Branching</strong></a><strong>, </strong><a href="https://www.codecademy.com/learn/learn-git"><strong>Code Academy — Learn Git</strong></a><strong>, </strong><a href="https://www.pluralsight.com/courses/code-school-git-real"><strong>Code School — Git real</strong></a></p><h4><a href="https://public-apis.io/">Public APIs</a></h4><figure><img alt="A screenshot of the Public APIs platform" src="https://cdn-images-1.medium.com/max/1024/1*SuKm4odohYV_O874z78dWQ.png" /><figcaption>Image by the Author. Source: <a href="https://public-apis.io/">https://public-apis.io/</a></figcaption></figure><p>A collection of public APIs to use in your projects, grouped into 40+ categories and updated regularly.</p><p>✨ Similar: <a href="https://free-for.dev/">Free For Dev</a></p><h3>Prototyping</h3><h4><a href="https://app.diagrams.net/">Draw.io</a></h4><figure><img alt="A look into Draw.io, a platform to create diagrams for free" src="https://cdn-images-1.medium.com/max/688/1*x3aju7F7gxfuKgn03NdC_w.png" /><figcaption>Image by the Author. Source: <a href="https://app.diagrams.net/">https://app.diagrams.net/</a> (formerly draw.io)</figcaption></figure><figure><img alt="A sample wireframe generated by Draw.io" src="https://cdn-images-1.medium.com/max/1024/1*bmQ8iXfQe1l3QItcXrE15w.png" /><figcaption>Sample wireframe provided on <a href="https://app.diagrams.net/">https://app.diagrams.net/</a></figcaption></figure><p>This free online tool allows you to create various diagrams, from basic flowcharts to UMLs, entity-relationship diagrams, maps, wireframes, and more. You can make use of their existing templates or start from scratch.</p><h4><a href="https://excalidraw.com/">Excalidraw</a></h4><figure><img alt="A wireframe created with Excalidraw" src="https://cdn-images-1.medium.com/max/1024/1*DPGZaFPaZzwgoa-2QiUJqQ.png" /><figcaption>Wireframe created by the Author using Excalidraw</figcaption></figure><p>Excalidraw provides you with a whiteboard to sketch diagrams. It also features a growing library that you can use to include more assets in your designs. The libraries include charts, form components, logos, media elements, and more. You can also create your own collection and add it to the library. You can also invite people to collaborate on your designs. The little drawback is that at the time of this writing, it does not yet support importing your own image files into your diagram.</p><h3>(On-page) SEO</h3><p>In a nutshell, Search Engine Optimization are a set of techniques that ensure your website ranks higher in search results. This allows your site to be properly indexed and to rank for relevant keywords, in order to help drive more traffic to your site.</p><blockquote>“ Even if you don’t have your own site, being able to implement best SEO practices onto the site’s of clients can make you more employable. (And ultimately be better for your pocket!) ”</blockquote><blockquote>— Source: <a href="https://learntocodewith.me/posts/learn-seo/">Learn SEO</a></blockquote><p>As a developer, when it comes to SEO, your concern will be to produce fast loading websites that have a good semantic markup. Among other things, this can be achieved by minifying your JS and CSS files, compressing your images and providing an Alt text, fixing broken links, including relevant meta data and schema information, generating sitemaps and robots.txt file, and creating friendly URLs.</p><p>If you want to learn more about SEO, these are good places to start: <a href="https://moz.com/learn/seo/seo-cheat-sheet">SEO cheat sheet</a>, <a href="https://livecodestream.dev/post/essential-guide-to-seo-for-web-developers/">SEO guide for developers</a>, <a href="https://www.searchenginejournal.com/complete-seo-checklist-web-developers/185410/">SEO checklist for web developers</a></p><p>You might be asked to add a tracking code on the website for Google Analytics. Below are some other tools you can use to find any SEO related issues with your website.</p><h4><a href="https://tools.pingdom.com/">Pingdom Speed Test</a></h4><figure><img alt="A look into the Pingdom Website Speed Test platform" src="https://cdn-images-1.medium.com/max/1024/1*SGfFzjMkqI2OVn3whimjjA.png" /><figcaption>Image by the Author. Source: <a href="https://tools.pingdom.com/">https://tools.pingdom.com/</a></figcaption></figure><p>Page speed is critical when it comes to SEO. Slow loading pages can frustrate your users and drive them away from your website. Pingdom, a website performance monitoring platform, provides a free tool to test and analyze your website speed. It also gives recommendations on how to improve your page performance.</p><p>✨ Similar: <a href="https://developers.google.com/speed/pagespeed/insights/">PageSpeed Insights</a></p><h4><a href="https://app.neilpatel.com/en/seo_analyzer/site_audit">Uber Suggest</a></h4><figure><img alt="A look into Uber Suggest, a platform by Neil Patel allowing you to improve your site’s SEO" src="https://cdn-images-1.medium.com/max/1024/1*AjudrmnqO5b9vGK55t7PUQ.png" /><figcaption>Image by the Author. Source: <a href="https://neilpatel.com/ubersuggest/">https://neilpatel.com/ubersuggest/</a></figcaption></figure><p>Ubersuggest contains <a href="https://app.neilpatel.com/en/seo_analyzer/site_audit">a site audit tool</a> to identify and fix SEO issues on your website. It shows how quickly your site loads, highlights errors, and provides your overall SEO score. It also provides recommendations on how to improve your rankings.</p><p>✨ Similar: <a href="https://www.seoptimer.com/">SEO Optimer</a>, <a href="https://www.seotesteronline.com/">SEO Tester Online</a></p><h4><a href="https://tinypng.com/">TinyPng</a></h4><figure><img alt="A look at Tiny PNG, a website allowing you to compress your images" src="https://cdn-images-1.medium.com/max/1024/1*-BXVGIBcn6npYk7qRZoTig.png" /><figcaption>Image by the Author. Source:</figcaption></figure><p>The image size plays a big role in how fast your website can load. Several online tools exist that allow you to reduce the size of your images.</p><p><strong>Note: Always check the terms of use of the site</strong></p><p>✨ Similar: <a href="https://compressjpeg.com/">Compress JPEG</a>, <a href="https://www.iloveimg.com/compress-image">iLoveIMG</a></p><h3>Images and videos</h3><p><strong>Note: Always check the license for the terms of use and attribution rules.</strong></p><h4><a href="https://iwaria.com/">Iwaria</a></h4><figure><img alt="A look at Iwaria.com, a website showcasing free African pictures for download" src="https://cdn-images-1.medium.com/max/1024/1*PGW9JRkuS2uNsweCPjz5zg.png" /><figcaption>Image by the Author. Source: Image by the Author. Source: <a href="https://iwaria.com/">https://iwaria.com/</a></figcaption></figure><p>Free African high-quality photos for your projects.</p><h4><a href="https://unsplash.com/">Unsplash</a></h4><figure><img alt="A screenshot of Unsplash, a platform with free high quality pictures" src="https://cdn-images-1.medium.com/max/1024/1*NWn6qVXiZVS97R41UdU8bQ.png" /><figcaption>Image by the Author. Source: <a href="https://unsplash.com/">https://unsplash.com/</a></figcaption></figure><p>Free high-resolution photos.</p><h4><a href="https://coverr.co/">Coverr</a></h4><figure><img alt="A screenshot of Coverr, a platform allowing you to download free high quality videos" src="https://cdn-images-1.medium.com/max/1024/1*t68_p6o0hi-Q586Sg7XMzA.png" /><figcaption>Image by the Author. Source: <a href="https://coverr.co/">https://coverr.co/</a></figcaption></figure><p>Beautiful free stock video footage.</p><h4><a href="https://www.remove.bg/">RemoveBg</a></h4><figure><img alt="A screenshot of Remove BG, a website to remove the background of any picture" src="https://cdn-images-1.medium.com/max/1024/1*iXB6e3ayGLmczxHksyZvwQ.png" /><figcaption>Image by the Author. Source: <a href="https://www.remove.bg/">https://www.remove.bg/</a></figcaption></figure><p>Remove the background from your images.</p><h3>Icons and Illustrations</h3><h4><a href="https://undraw.co/illustrations">Undraw</a></h4><figure><img alt="A look at Undraw.co, a collection of open-source illustrations" src="https://cdn-images-1.medium.com/max/1024/1*fIettZW9BxMDxlsu1djisA.png" /><figcaption>Image by the Author. Source: <a href="https://undraw.co/illustrations">https://undraw.co/illustrations</a></figcaption></figure><p>Undraw is a collection of open-source illustrations created by <a href="https://ninalimpi.medium.com/">Katerina Limpitsouni</a>. On the website, you can use the color picker tool to match your brand identity and the search bar to easily find illustrations based on keywords. The illustrations can be downloaded in SVG or PNG format. You can follow their updates on their <a href="https://twitter.com/undraw_co">Twitter account</a>.</p><h4><a href="https://storyset.com/">Storyset</a></h4><figure><img alt="A look at StorySet — a collection of free and customisable illustrations" src="https://cdn-images-1.medium.com/max/1024/1*o2w0MWouFsKR8Beln9tIRA.png" /><figcaption>Image by the Author. Source: <a href="https://storyset.com/">https://storyset.com/</a></figcaption></figure><p>Formerly (<a href="https://stories.freepik.com/search">https://stories.freepik.com/</a>), this is another great website that allows you to customize, animate and download beautiful illustrations to make incredible landing pages, apps or presentations! You can easily remove the layers you don’t need from the illustrations.</p><h4><a href="https://heroicons.com/">Heroicons</a></h4><figure><img alt="A screenshot of HeroIcons, a collection of free SVG icons" src="https://cdn-images-1.medium.com/max/1024/1*aIDH4ezuzhYvtX9Jbm-aWw.png" /><figcaption>Image by the Author. Source: <a href="https://heroicons.com/">https://heroicons.com/</a></figcaption></figure><p>Beautiful hand-crafted SVG icons.</p><p>✨ Alternative: <a href="https://www.flaticon.com/">Flaticon</a>, <a href="https://feathericons.com/">Feather</a></p><h3>Colors</h3><h4><a href="https://coolors.co/">Coolors</a></h4><figure><img alt="A screenshot of Coolors, a platform to generate colour combinations" src="https://cdn-images-1.medium.com/max/1024/1*2ToL2lPwpFQpVo003SkX2g.png" /><figcaption>Image by the Author. Source: <a href="https://coolors.co/">https://coolors.co/</a></figcaption></figure><p>Generate beautiful color combinations for your web, mobile or graphic designs. Set a primary color by toggling the lock. Press the space bar to generate complementary color palettes.<strong> Check out </strong><a href="https://stephaniewalter.design/blog/color-accessibility-tools-resources-to-design-inclusive-products/"><strong>this blog post</strong></a><strong> to learn more about color accessibility and the tools available to help you build inclusive products.</strong></p><p>✨ Similar: <a href="https://colorhunt.co/">Color Hunt</a>, <a href="https://www.colorhexa.com/">Color Hexa</a></p><h3>Final thoughts</h3><p>Thanks for reading! If you enjoyed this article, please don’t forget to give it a 👏 , to share it, or to leave a comment. Also, I would love to read about any other tool that has helped you in your development process.</p><p>Stay blessed! 🌼</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92f25d43aa04" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/a-handful-list-of-resources-for-web-developers-92f25d43aa04">A handful list of resources for web developers</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel API file upload to AWS]]></title>
            <link>https://blog.devgenius.io/laravel-api-file-upload-to-aws-a8e87319b82e?source=rss-cfafb589c824------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e87319b82e</guid>
            <category><![CDATA[file-upload]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[amazon-s3]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Marie Mbenoun]]></dc:creator>
            <pubDate>Sun, 09 Aug 2020 20:36:46 GMT</pubDate>
            <atom:updated>2020-08-11T16:53:30.409Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to set up an amazon bucket and upload files from a Laravel API application</h4><figure><img alt="Laravel API and Amazon S3 cover image" src="https://cdn-images-1.medium.com/max/720/1*Rks9oGr9mlXCulZZop6gDQ.jpeg" /><figcaption>Image by Author. SVG illustration by <a href="https://undraw.co/illustrations">Undraw</a></figcaption></figure><p>Amazon S3 ( Simple Storage Service) is a cloud storage facility that allows for the upload, storage and retrieval of data, including static websites, images and documents. You can read more about S3 benefits on Amazon’s <a href="https://aws.amazon.com/s3/">official documentation</a>.</p><p>Laravel provides drivers to easily connect and upload your data to Amazon S3, and we are going to see how. The source code is available <a href="https://github.com/emygeek/laravel-aws-s3-demo">here</a>. This article is divided in 3 sections:</p><ol><li><a href="#7477">Project setup</a>, where we create the Document Model and the related migration, controller and API resource</li><li><a href="#26e0">File upload</a>, where we add a script to upload files to S3</li><li><a href="#6959">Amazon bucket setup</a></li><li><a href="#2f60">Env and config file setup</a></li></ol><p>We are going to use <a href="https://www.postman.com/downloads/">Postman</a> to test the API routes.</p><blockquote><strong>Disclaimer</strong>: the focus of this article is the file upload, retrieval and deletion from Amazon S3. API authentication is outside the scope of this article. If need be, read more on <a href="https://laravel.com/docs/7.x/passport">Passport authentication</a>, but ideally, one should authenticate users making requests to/via the API.</blockquote><h4>Project Setup</h4><p>Let’s create a new Laravel project</p><pre>composer create-project --prefer-dist laravel/laravel laravel-aws-demo</pre><p>Move into the project and create the Document model and the related migration.</p><pre>cd laravel-aws-demo &amp;&amp; php artisan make:model Models/Document -m</pre><p>Let’s modify the documents migration.</p><pre>Schema::create(&#39;documents&#39;, function (Blueprint $table) {<br>    $table-&gt;id();<br>    $table-&gt;string(&#39;name&#39;);<br>    $table-&gt;string(&#39;path&#39;);<br>    $table-&gt;timestamps();<br>});</pre><blockquote>You can use UUID instead of auto-increment IDs for your primary key on your models. I have covered using UUID in Laravel in <a href="https://medium.com/@emymbenoun/how-to-use-uuids-instead-of-auto-increment-ids-in-your-laravel-app-2e6cc045f6c1">this article</a>.</blockquote><p><strong>In order to</strong><a href="https://laravel.com/docs/7.x/filesystem#driver-prerequisites"><strong> connect to the s3 bucket</strong></a><strong> inside a Laravel app, you need to install this required package:</strong></p><pre>composer require league/flysystem-aws-s3-v3 ~1.0</pre><p>Lastly, update your .env file with your database credentials. Then run php artisan migrate.</p><h4>File Upload</h4><p>Let’s create the file upload controller. For this demo, we are only going to focus on the store and destroy methods.</p><pre>php artisan make:controller DocumentsController --api</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91cacc78dc63b85a75dcd73f4076cfeb/href">https://medium.com/media/91cacc78dc63b85a75dcd73f4076cfeb/href</a></iframe><p>When the store() method runs, a folder ‘user_documents’ will be created inside the s3 bucket (that we will specify in the .env file), and the folder will contain the file we uploaded. The file name will be hashed. In case you want to specify the name of the file, you can use the storeAs() method. Since we are not using the default storage path, we need to specify the disk that will be used, in this case s3. Same applies to the destroy method, we need to specify the s3 disk.</p><p>Now let’s create a Document <a href="https://laravel.com/docs/7.x/eloquent-resources">resource</a> to format the response sent to the user php artisan make:resource DocumentResource</p><pre>&lt;?php</pre><pre>namespace App\Http\Resources;</pre><pre>use Illuminate\Http\Resources\Json\JsonResource;<br>use Storage;</pre><pre>class DocumentResource extends JsonResource<br>{<br>    /**<br>     * Transform the resource into an array.<br>     *<br>     * <a href="http://twitter.com/param">@param</a>  \Illuminate\Http\Request  $request<br>     * <a href="http://twitter.com/return">@return</a> array<br>     */<br>    public function toArray($request)<br>    {<br>        return [<br>            &quot;id&quot; =&gt; $this-&gt;id,<br>            &quot;name&quot; =&gt; $this-&gt;name,<br>            &quot;path&quot; =&gt; !empty($this-&gt;path) ? Storage::disk(&#39;s3&#39;)-&gt;url(https://medium.com/$this-&gt;path) : &#39;&#39;,<br>        ];<br>    }<br>}</pre><p>Let’s update the routes/api.php file.</p><figure><img alt="API routes for storing and deleting documents" src="https://cdn-images-1.medium.com/max/1024/1*SqOAXi35X1wU22CkVjlmCg.png" /><figcaption>Image by Author</figcaption></figure><h4>Amazon account setup</h4><p>Head over to <a href="https://aws.amazon.com/s3/">Amazon Web Services</a> and create an account. You will need to enter your billing details for your account to be <a href="https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/">active</a>. Any service listed under their <a href="https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;all-free-tier.sort-order=asc">Free Tier</a> is free for 1 year as long as you remain within their usage limit. Once your account is verified and active, on the top menu, click on Services, and select S3.</p><figure><img alt="Navigation menu to open the S3 page on Amazon" src="https://cdn-images-1.medium.com/max/1024/1*UQlMwkjE14XcO_5abKXENA.png" /><figcaption>Image by Author</figcaption></figure><figure><img alt="Amazon S3 Buckets page" src="https://cdn-images-1.medium.com/max/1024/1*CfYsh6hZFlY_hK2gxBZMFg.png" /><figcaption>Image by Author</figcaption></figure><p>Click on the Create Bucket button. On the new page, enter a unique bucket name and select the region:</p><figure><img alt="Creating a bucket — Set bucket name and region" src="https://cdn-images-1.medium.com/max/871/1*4US5mWsTpyBNRgbFIE6hRw.png" /><figcaption>Image by Author</figcaption></figure><p>If your region does not appear by default, you can <a href="https://docs.aws.amazon.com/general/latest/gr/rande-manage.html">enable it</a> for your account.</p><blockquote>Based on my configuration, in my Laravel .env file, my region configuration will beAWS_DEFAULT_REGION=af-south-1. We will be updating the .env file later.</blockquote><p>The next section allows you to set up the visibility of the bucket. It is set to block all access by default. You need to untick to allow read and write access.</p><p><strong><em>Warning</em></strong><em>! Grant or deny access to your bucket based on your requirements. Read more about buckets security </em><a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/security-best-practices.html"><em>here</em></a><em>)</em></p><figure><img alt="Creating a bucket — Set permissions" src="https://cdn-images-1.medium.com/max/867/1*jJL4fBLF4gGVH3Gl0I8gzA.png" /><figcaption>Image by Author</figcaption></figure><p>Update the following sections as per your requirements</p><figure><img alt="Creating a bucket — Versioning, tags and encryption" src="https://cdn-images-1.medium.com/max/800/1*fnd2h0jM4dL15_wpDDfSDg.png" /><figcaption>Image by Author</figcaption></figure><figure><img alt="Creating a bucket — Object locking" src="https://cdn-images-1.medium.com/max/867/1*O6vJmPKUtyYKMQvq_qNQZQ.png" /><figcaption>Image by Author</figcaption></figure><p>You can update these settings later. Click on <strong>Create bucket</strong>.</p><figure><img alt="Showing the new bucket created" src="https://cdn-images-1.medium.com/max/1024/1*Md38cMuICJZ0e2KFuelmRw.png" /><figcaption>Image by Author</figcaption></figure><p>This is what your bucket looks like:</p><figure><img alt="Showing the inside of an S3 bucket" src="https://cdn-images-1.medium.com/max/1024/1*MbGL-wRqRdhtlwiTe50UOg.png" /><figcaption>Image by Author</figcaption></figure><p>Now that the bucket is created, we need to set up access keys that our API will use to connect to our bucket. On the top menu, under your account name, select Security Credentials.</p><figure><img alt="Selecting security credentials" src="https://cdn-images-1.medium.com/max/1024/1*vKqB92Hfu3vbBnsbNNXH4Q.png" /><figcaption>Image by Author</figcaption></figure><p>Click on Users on the left sidebar, then click on the Add User button:</p><figure><img alt="A look at Add User screen" src="https://cdn-images-1.medium.com/max/1024/1*HCWWBiLPUUNrl57tg1igCg.png" /><figcaption>Image by Author</figcaption></figure><p>Let’s dive in. Step 1: Create a new user</p><figure><img alt="Step 1 — Adding a user: set user details" src="https://cdn-images-1.medium.com/max/1024/1*OYsOTmgF1IUPqaddBnnGWg.png" /><figcaption>Image by Author</figcaption></figure><p>Step 2: Click on <strong>Attach existing policies directly</strong>. Search for AmazonS3 in the filter, and select AmazonS3FullAccess to be able to have read and write access to the bucket.</p><figure><img alt="Step 2 — Adding a user: attach permissions" src="https://cdn-images-1.medium.com/max/1024/1*uQHPf1ugp9wfstn1cgMEkA.png" /><figcaption>Image by Author</figcaption></figure><p>Step 3: Add tags (optional)</p><figure><img alt="Step 3— Adding a user: add tags (optional)" src="https://cdn-images-1.medium.com/max/1024/1*6H3yGu46-LD4B8mnY5qPiQ.png" /><figcaption>Image by Author</figcaption></figure><p>Step 4: Review your input</p><figure><img alt="Step 4— Adding a user: review inputs" src="https://cdn-images-1.medium.com/max/1024/1*hSxxYVSn8Hg6P179pygnkA.png" /><figcaption>Image by Author</figcaption></figure><p>Step 5: Your user is created. <strong>Copy the Access key ID and the secret access key. </strong>These values will go to your .env file.</p><figure><img alt="Step 5— Adding a user: Get your credentials" src="https://cdn-images-1.medium.com/max/1024/1*1m7PTOYjufvK-BAsPtvC3w.png" /><figcaption>Image by Author</figcaption></figure><h4>Env and config files setup</h4><pre>AWS_ACCESS_KEY_ID=PUT_THE_ACCESS_KEY_ID<br>AWS_SECRET_ACCESS_KEY=PUT_THE_SECRET_ACCESS_KEY<br>AWS_DEFAULT_REGION=PUT_THE_SELECTED_REGION_CODE<br>AWS_BUCKET=PUT_YOUR_BUCKET_NAME</pre><p><strong>Set up file visibility</strong></p><p>Open the config/filesystems.php file, that contains the filesystem configuration of our Laravel app. Scroll down to the Filesystem disks section. By default, Laravel includes the configuration for the local, public and s3 disks. You are free to add additional disks or update the existing ones. To be able to access/view the files after they have been uploaded to Amazon S3, you can change the visibility of the S3 disk to public.</p><pre>&#39;visibility&#39; =&gt; &#39;public&#39;,</pre><p>Your s3 settings will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OtP-Q4x6p8kAgH5i-3FflQ.png" /></figure><blockquote>If you do not want all the files uploaded to the S3 bucket to be accessible by default, instead of adding/updating the visibility setting of your s3 disk to public, you can do it on a per file basis. For instance, when storing the file, you will need to set the visibility to public as below:</blockquote><pre>$documentPath = $request-&gt;file(&#39;document&#39;)-&gt;store($base_location, [&#39;disk&#39; =&gt; &#39;s3&#39;, &#39;visibility&#39; =&gt; &#39;public&#39;]);</pre><p><strong>Testing</strong></p><p>Let’s head over to Postman. Create a new POST request. Select Body &gt; form-data.</p><p>Enter the key names as on the screenshot. By default, the property type is set to text. You need to select <strong>File</strong> from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*tvNzEWoDnm2piX9Qk_Ys-w.png" /></figure><p>Once you upload the file and click on <strong>Send</strong>, you should see a similar result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*Jln36rZWlw9utAmIJpT2VA.png" /></figure><p>The database will look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*_1UgZyrTqJH7ntBUULtc9A.png" /></figure><p>The bucket will show a new folder called user_documents, and inside you will find the file we uploaded:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*1PpjY1mop2f61dSFu9wjKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*YN7mR91y3O2NjFnvj1FGJA.png" /></figure><h4>Possible errors you might run into</h4><p><strong>1- Adapter not found</strong></p><pre>Class &#39;League\Flysystem\AwsS3v3\AwsS3Adapter&#39; not found</pre><p>Please make sure you run the composer command to install the adapter: composer require league/flysystem-aws-s3-v3 ~1.0</p><p><strong>2- Error retrieving credentials</strong></p><pre><strong>Error</strong> retrieving credentials from the instance profile metadata service. (cURL error 7: Failed to connect to xxx.xxx.xxx.xxx port 80: Operation timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)) </pre><p>Double-check your AWS credentials in the .env file</p><p><strong>3- Access denied error</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*fg79C2mpUuifkMje-IwCLg.png" /></figure><p>You might see this error when trying to open the URL on the browser. This happens because when uploading the file, its visibility was set to private. You can change the visibility of an existing file using the setVisibility method. You can read more about it <a href="https://laravel.com/docs/7.x/filesystem#file-visibility">here</a>. It might also be a sign the S3 bucket blocks public access to its data.</p><h4>Closing words</h4><p>If you have any question or comment please leave them below, or connect with me on Twitter <a href="https://twitter.com/MarieInnov">@MarieInnov</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e87319b82e" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/laravel-api-file-upload-to-aws-a8e87319b82e">Laravel API file upload to AWS</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do [most] developers hate CSS?]]></title>
            <link>https://uxdesign.cc/why-do-most-developers-hate-css-63c92bce36ed?source=rss-cfafb589c824------2</link>
            <guid isPermaLink="false">https://medium.com/p/63c92bce36ed</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Marie Mbenoun]]></dc:creator>
            <pubDate>Mon, 13 Jul 2020 17:55:22 GMT</pubDate>
            <atom:updated>2020-07-14T11:33:42.554Z</atom:updated>
            <content:encoded><![CDATA[<h4>What every developer needs to know about modern CSS.</h4><figure><img alt="CSS is awesome mug by Steve Frank" src="https://cdn-images-1.medium.com/max/680/1*y55rAsxEb4rq2WynbB4mIw.jpeg" /><figcaption>CSS is awesome mug by <a href="https://stevenf.tumblr.com/">Steve Frank</a></figcaption></figure><p>For some time now, I have been reading and hearing a lot of people complain about CSS. I have come across a lot of discussions where front-end developers express their discontentment with how the industry devalues their skills. While browsing through one of the threads discussing this, I came across this reply which I found interesting:</p><h3></h3><p></p><p>I liked the quote even more because I think it applies to everything we do in life, not just programming. If we find someone passionate about their craft, and they teach us, we are more likely to enjoy the process and maybe even, develop a love for it.</p><p>I have gone through most of the recurring reasons people give to justify their hate for CSS.<strong> I would like us to go through some of them</strong>:</p><h4><strong><em>1- “It’s hard to debug.”</em></strong></h4><p>Let’s say you have created your HTML structure and confidently added rules in your stylesheet. However, you refresh the page and the UI is broken or your changes are not reflecting.</p><p>When it comes to debugging, the developer console is your friend. <a href="https://cssfordesigners.com/articles/troubleshooting-your-css">This article </a>gives a simple guide to troubleshooting CSS. <a href="https://cloudfour.com/thinks/developer-tools-for-designers/">Developer Tools for designers</a> is also an awesome read with tips to master the console. Let’s have a look at some recurring cases that frustrate developers:</p><p><strong>Overflow</strong></p><p>How many times have you had to fight with an element overflowing on the page? You can use this old-school snippet to visualise the boundaries of every element on the page and help you catch the misbehaving element:</p><figure><img alt="When testing, you can set the outline property to visualise the boundaries of all the elements on the page" src="https://cdn-images-1.medium.com/max/1024/1*Hh1Z2-P5ACvtuIkUrzP6oA.png" /><figcaption>Image by author</figcaption></figure><figure><img alt="An example of a webpage with outline set on to view element’s boundaries" src="https://cdn-images-1.medium.com/max/1024/1*XgKPKUo9gKpUNUxaN4eL7w.png" /><figcaption>Image by Author</figcaption></figure><p>The <strong>outline</strong> property can also be used to debug <strong>accessibility</strong> issues. For example, it can be used to help check for missing/empty alt tags on images that are not decorative.</p><h3></h3><p>Debug images without alt attribute with CSS. #lintHTMLwithCSS #a11y (inspired by @argyleink 😊) pic.twitter.com/OQmuAG3NIW</p><p>The <strong>outline</strong> property is also crucial in giving a visual indicator of focus to users. If you have disabled outline anywhere in your stylesheet with outline:none; without providing alternative styling, you are probably hurting your site’s accessibility.</p><h3></h3><p>a11y tip 🤔Don&#39;t remove CSS outlines, it removes the visible indication of focus for keyboard users.:focus { outline: none; } ❌Modify the look instead::focus { text-decoration: underline; } ✅:focus { outline: thin dotted; } ✅:focus { border-color: #000; } ✅</p><h3></h3><p>Have you ever seen this piece of CSS?*:focus { outline: none;}For some users, it&#39;s essentially the same as:* { cursor: none;}Keyboard accessibility matters. Thanks @sarbbottam for your insightful talk!#EmpireJS #a11y #empathy #css #antipattern</p><p><strong>Positioning</strong></p><p>One of my first ‘Ah ha’ moments with CSS was when I got to understand absolute positioning for centering. Now Flexbox and CSS grid make things easier, but let’s try an old-school trick to vertically and horizontally align an element.</p><pre>.parent-div{<br>    position:relative;<br>    height: 100vh;<br>    width: 100%;<br>}<br>.element-to-align{<br>    position: absolute;<br>    top: 50%;<br>    left: 50%;<br>    transform: translate(-50%, -50%);<br>    margin-right: -50%;<br>}</pre><p>In the snippet above, it’s very important that the container (in this case, .parent-div) has its position set to relative. I am using 100vh for the height and 100% for the width to create a full screen section, but feel free to modify these values.</p><p>The div to center has its position set to absolute. That puts it in the top left corner of the parent div. We want to center vertically, so we use a percentage value of 50% ( top:50% : places the content halfway down the container, in other words, at half the height of the .parent-div). We use the same logic to center the content horizontally ( left: 50% : places the content at half the width of the .parent-div). The transform: translate() moves the content up by half its own height, and towards its left by half its own width.The margin: -50% allows the content to span the full width of the container,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Femygeek%2Fembed%2Fpreview%2FrNxrxxz%3Fheight%3D600%26slug-hash%3DrNxrxxz%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Femygeek%2Fpen%2FrNxrxxz&amp;image=https%3A%2F%2Fassets.codepen.io%2F1041716%2Finternal%2Fscreenshots%2Fpens%2FrNxrxxz.default.png%3Fformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D1%26amp%3Bversion%3D1594569385%26amp%3Bwidth%3D640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d2fe8768ed2766bb4037db2c5ca2876/href">https://medium.com/media/6d2fe8768ed2766bb4037db2c5ca2876/href</a></iframe><p>Alternatively you can use Flexbox like on the snippet below:</p><figure><img alt="Flexbox way of centering content vertically and horizontally" src="https://cdn-images-1.medium.com/max/1024/1*vx8HLvRZGMquhYfdcCqafQ.png" /><figcaption>(No need to add custom styling on the .element-to-align div) — Image by Author</figcaption></figure><p>Other concepts that are sometimes difficult to grasp relate to the box model, the difference between displays (block, inline, inline-block), spacing, pseudo-elements and other fundamentals of CSS. I have come across a great article that nicely explains these concepts: <a href="https://cssfordesigners.com/articles/things-i-wish-id-known-about-css">https://cssfordesigners.com/articles/things-i-wish-id-known-about-css</a></p><h4><strong><em>2- ”Css is hard to understand”</em></strong></h4><p><em>CSS — Cascading Style Sheets.</em></p><p>One of the key concepts of CSS is <strong>specificity</strong>. Some of the reasons that your new rule is not being applied could be that there is a more specific selector taking precedence over it. Applying !important is not always the quick fix and can make it harder to update existing styles.</p><blockquote>Specificity determines which styles apply to an element when more than one rule could apply.(<a href="https://en.wikipedia.org/wiki/Cascading_Style_Sheets#Specificity">Src</a>) The more specific a CSS style is, the more likely it is to take precedence over any other style applied to the same element.</blockquote><p>A nice article I came across, written by Emma Bostian, explains how to determine CSS specificity with a lot of great examples and a specificity calculator. You can read about it here: <a href="https://dev.to/emmabostian/css-specificity-1kca">https://dev.to/emmabostian/css-specificity-1kca</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*ttyBrYmd9S0LasztIvVcKA.png" /></figure><h4>3- <em>“Browser compatibility/support”</em></h4><p>This has been a big issue for many years, with developers needing to include additional rules or hacks to ensure their CSS would work on all major browsers. However, a lot of progress has been made in the dev community to bridge the gap for browser compatibility.</p><p>In case you wonder if a certain property has browser support, you can use a tool like <a href="https://caniuse.com/">https://caniuse.com/</a> .</p><figure><img alt="A screenshot of CanIUse.com, a website to check browser support for CSS properties" src="https://cdn-images-1.medium.com/max/1024/1*LgD9Jy-rHRB5lgHBooQn4w.png" /><figcaption>Screenshot by Author — Source <a href="https://caniuse.com/">Can I Use</a></figcaption></figure><h4><em>4- “Too many CSS frameworks”</em></h4><p><a href="https://github.com/troxler/awesome-css-frameworks">CSS frameworks</a> can be very useful to speed up development time. However it’s still crucial for developers to understand the fundamental of CSS and be able to create UI with plain CSS. One personal challenge I worked on years back was to redesign the Google homepage without any CSS framework. It helped me carefully plan my HTML structure as well as get my hands dirty with positioning.</p><p>I recently came across the profile of <a href="https://twitter.com/gertiesheshe">Gertrude Nyenyeshi</a>, founder of Accessibility Africa, who has given herself the challenge to redesign popular apps UI with only HTML and CSS and the result is remarkable.</p><h3></h3><p>To distract myself in this period and to improve on a skill I&#39;ve been neglecting, I&#39;ve taken up building popular apps UIs using HTML and CSS only - no frameworks. Did @Spotify Browse page this week and I&#39;m happy with it :)Screenshot of mine vs theirs: pic.twitter.com/gXXWdiWQP0</p><p>Practice makes perfect, so if you consider yourself an “<a href="https://twitter.com/_marcba/status/1241248050372390913">advanced beginner</a>”, why not take on a similar challenge or practice building more advanced UI using the latest CSS technologies. The <a href="https://www.dailyui.co/">dailyUI</a> challenge has a big community support and you can get encouraged by seeing what others do.</p><h4>5- “CSS is repetitive and boring”</h4><p>CSS has its own coding standards for maintainability and scalability. You can organise your code with <a href="https://sass-lang.com/">Sass</a> and <a href="http://getbem.com/">BEM</a>. CSS allows you to make use of variables and functions. <a href="https://maintainablecss.com/">This site by Adam Silver</a> teaches you how to write modular, scalable and maintainable CSS. You can also browse <a href="https://stylestage.dev/">StyleStage</a> for a showcase of modern CSS properties.</p><figure><img alt="A screenshot of StyleStage website that showcases modern CSS properties" src="https://cdn-images-1.medium.com/max/903/1*sWghVFn9lwVjWMBKfxFf7g.png" /><figcaption>Screenshot b Author — Source <a href="https://stylestage.dev/">StyleStage</a></figcaption></figure><p>Furthermore, CSS is more than just writing a set of rules. A lot of CSS developers can delightfully manipulate SVG, typography and spacing; they understand colour theory, animations and accessibility.</p><p>I have come across a lot of awesome work created by enthusiast front-end designers that showcase the amazing things CSS can do:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Flynnandtonic%2Fembed%2Fpreview%2FLYGjqOo%3Fheight%3D600%26slug-hash%3DLYGjqOo%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Flynnandtonic%2Fpen%2FLYGjqOo&amp;image=https%3A%2F%2Fassets.codepen.io%2F1025350%2Finternal%2Fscreenshots%2Fpens%2FLYGjqOo.custom.png%3Fformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D1%26amp%3Bversion%3D1594184663%26amp%3Bwidth%3D640&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/37235e52afc7d8dee279b2ee569da516/href">https://medium.com/media/37235e52afc7d8dee279b2ee569da516/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fivorjetski%2Fembed%2Fpreview%2FxxGYWQG%3Fheight%3D600%26slug-hash%3DxxGYWQG%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fivorjetski%2Fpen%2FxxGYWQG&amp;image=https%3A%2F%2Fassets.codepen.io%2F2262345%2Finternal%2Fscreenshots%2Fpens%2FxxGYWQG.default.png%3Fformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D1%26amp%3Bversion%3D1590011061%26amp%3Bwidth%3D640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/9db2121378fc8f28d7679e645305a895/href">https://medium.com/media/9db2121378fc8f28d7679e645305a895/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fkassandrasanch%2Fembed%2Fpreview%2FqBbpgPx%3Fheight%3D600%26slug-hash%3DqBbpgPx%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fkassandrasanch%2Fpen%2FqBbpgPx&amp;image=https%3A%2F%2Fassets.codepen.io%2F2970881%2Finternal%2Fscreenshots%2Fpens%2FqBbpgPx.default.png%3Fformat%3Dauto%26amp%3Bha%3Dfalse%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D1%26amp%3Bversion%3D1593964307%26amp%3Bwidth%3D640&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/24efc5b115125434ad57c7944453e071/href">https://medium.com/media/24efc5b115125434ad57c7944453e071/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fderyatanriverdi88%2Fembed%2Fpreview%2FRwNELzd%3Fheight%3D600%26slug-hash%3DRwNELzd%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fderyatanriverdi88%2Fpen%2FRwNELzd%3Feditors%3D1100&amp;image=https%3A%2F%2Fassets.codepen.io%2F3928791%2Finternal%2Fscreenshots%2Fpens%2FRwNELzd.default.png%3Fformat%3Dauto%26amp%3Bha%3Dtrue%26amp%3Bheight%3D360%26amp%3Bquality%3D75%26amp%3Bv%3D1%26amp%3Bversion%3D1580145064%26amp%3Bwidth%3D640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/5827a8bc6501842b397fe620fc6eff3c/href">https://medium.com/media/5827a8bc6501842b397fe620fc6eff3c/href</a></iframe><figure><img alt="A pure CSS painting by Diana Adrianne" src="https://cdn-images-1.medium.com/max/760/1*4jxFs69H4MIchb2kD0_weA.png" /><figcaption>Screenshot by Author — Source: <a href="https://diana-adrianne.com/purecss-gaze/">https://diana-adrianne.com/purecss-gaze/</a></figcaption></figure><h4>Final words</h4><p>I love CSS, I love seeing beautiful interfaces and I am even more impressed when the designer has put a great deal of attention to details. I think CSS is awesome. And I appreciate all the work front-end and UX engineers do to make the web more accessible and responsive for all.</p><p><strong>What is your take? Do you love CSS? Why or Why not? I would love to hear.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63c92bce36ed" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/why-do-most-developers-hate-css-63c92bce36ed">Why do [most] developers hate CSS?</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping 101: Let’s Build a Curated List Using Laravel 7 and Tailwind CSS]]></title>
            <link>https://medium.com/swlh/web-scraping-101-lets-build-a-curated-list-using-laravel-7-and-tailwind-css-beca3ca98651?source=rss-cfafb589c824------2</link>
            <guid isPermaLink="false">https://medium.com/p/beca3ca98651</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[goutte]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <dc:creator><![CDATA[Marie Mbenoun]]></dc:creator>
            <pubDate>Sat, 04 Jul 2020 20:17:54 GMT</pubDate>
            <atom:updated>2020-07-06T14:28:34.068Z</atom:updated>
            <content:encoded><![CDATA[<p>Web scraping is a technique used to extract useful information by analysing the HTML content of a website. Web scraping is useful in cases where you need to access the content of a website that does not provide API end points. You can find out more about how businesses use web scraping <a href="https://www.parsehub.com/blog/web-scraping-examples/">here</a> and <a href="https://scrapy.ninja/en/16-real-life-examples-of-data-scraping-for-business/">here</a>.</p><blockquote>Please be aware of these scraping rules: (<a href="https://github.com/Sangarshanan/webscraping-and-analysis-of-medium-articles#scraping-rules"><strong>Source</strong></a><strong>)</strong></blockquote><blockquote>You should check a website’s Terms and Conditions before you scrape it. Be careful to read the statements about legal use of data. Usually, the data you scrape should not be used for commercial purposes.</blockquote><blockquote>Do not request data from the website too aggressively with your program (also known as spamming), as this may break the website.</blockquote><blockquote>The layout of a website may change from time to time, so make sure to revisit the site and rewrite your code as needed</blockquote><h4>What will we build?</h4><p>When looking for a website to scrap, make sure it</p><ul><li>has HTML tags with a <strong><em>comprehensible class or id</em></strong></li><li>uses classes and ids in a <strong><em>consistent</em></strong> way</li><li>has <strong><em>well-structured URLs. (</em></strong><a href="https://www.freecodecamp.org/news/scrape-the-web-for-top-rated-movies-on-tv/"><strong><em>Source</em></strong></a><strong><em>)</em></strong></li></ul><p>For this demo, we are going to build a small job listing platform. <strong>(</strong><a href="https://github.com/emygeek/laravel-job-scrapper-demo"><strong>Access the source code here</strong></a><strong>)</strong>. Here is a preview of what the final product will look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2NdXyI6_IjBA-adLR_QzQ.png" /></figure><p>We will be installing <a href="https://github.com/FriendsOfPHP/Goutte">Goutte</a>, a PHP web scraping library. To scrap a web page is as easy as making an Http request to a specific URL and analysing the HTML content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvJzIgrkBDJc0v32YFunFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkY9qfOSuvLugnnJnWO-Ag.png" /><figcaption>Sample h2 link inside a div representing a blog post on the symfony blog page</figcaption></figure><p>We will be scraping job listings from developers’ favourite website: <a href="https://stackoverflow.com/jobs">Stackoverflow</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-chsoanP_7xU4ynQOYnKA.png" /></figure><h4><strong>Set up</strong></h4><p><strong>Read on to see how to setup a Laravel project with Tailwind CSS. Alternatively, you can skip this section and jump to </strong><a href="#6bc6"><strong>Scraping</strong></a><strong>.</strong></p><p>First let’s set up our Laravel project. In the terminal, run</p><pre>composer create-project --prefer-dist laravel/laravel laravel-job-scraper</pre><p>This will create a new directory (laravel-job-scraper) with a fresh installation of Laravel 7.</p><blockquote>You can specify the version of Laravel you need by appending the version number at the end of the command like: composer create-project prefer-dist laravel/laravel laravel-job-scraper &quot;7.0.x&quot;</blockquote><p>When it’s done installing, navigate into the laravel-job-scraper project.</p><pre>cd laravel-job-scraper</pre><p>Since we are using Laravel 7, the css scaffolding requires us to install the Laravel ui package. If you are not familiar with this, you can check the official documentation <a href="https://laravel.com/docs/7.x/frontend">here</a>. Let’s run</p><pre>composer require laravel/ui</pre><p>Once the laravel/ui package has been installed, you may install the frontend scaffolding using the ui Artisan command: (Current options available are Bootstrap, Vue and React. However there might soon be a Tailwind option)</p><pre>php artisan ui vue</pre><p>If you run php artisan serve, you will see the following screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*STFVVNYIo7quyy8gO08wkA.png" /></figure><p>Now, let’s install Tailwind CSS.</p><pre>npm install tailwindcss --save</pre><p>This adds Tailwind CSS to our node_modules. Now navigate to resources/sass and replace the content of the <em>app.scss</em> file with Tailwind imports</p><pre>@tailwind base;</pre><pre>@tailwind components;</pre><pre>@tailwind utilities;</pre><p>Now let’s create the tailwind configuration file. This file is going to be used by Laravel mix when we will build scss into css.</p><pre>npx tailwind init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2dEeIblRgUvJwyh-2L4sw.png" /></figure><p>The newly created<em> tailwind.config.js </em>file should contain the following JavaScript configuration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0IBgfQfTnru0jJI2pZMmQ.png" /></figure><p>Let’s update the content of the <em>webpack.mix.js</em> file with the following tailwind css imports (in bold).</p><pre>const mix = require(&#39;laravel-mix&#39;);<br><strong>const tailwindcss = require(&#39;tailwindcss&#39;);</strong></pre><pre>mix.js(&#39;resources/js/app.js&#39;, &#39;public/js&#39;)<br>      .sass(&#39;resources/sass/app.scss&#39;, &#39;public/css&#39;)<br>      <strong>.options({<br>           processCssUrls: false,<br>           postCss: [tailwindcss(&#39;./tailwind.config.js&#39;)],</strong><br><strong>})</strong>;  </pre><p>Run</p><pre>npm install<br>npm run dev</pre><p>Lastly, let’s install <a href="https://github.com/FriendsOfPHP/Goutte">Goutte</a></p><pre>composer require fabpot/goutte</pre><h4>Scraping</h4><p>Let’s head over to Stackoverflow jobs. Goutte will help us extract the HTML content from the page.</p><p>Let’s inspect any of the job listing using the developer console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bC3ogO7NAzWsliOfYg6FCw.png" /></figure><p>All the job listings are contained inside a div with a class of &lt;div class=&#39;listResults&#39;&gt; . Each job (highlighted in blue with green padding) consists of a div with classes &lt;div class=&#39;-job js-result js-dismiss-overlay-container ps-relative_selected js-selected..&#39;&gt;</p><p>As we expand each of the job, we can see more details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rI_wF0jAIRY0LQE0IpVmbA.png" /></figure><p>The job titles are inside h2 tags, the programming tags (eg: reactjs, php) are inside &lt;div class=&#39;ps-relative d-inline-block z-selected&#39;&gt; and listed in &lt;a class=&#39;&#39;post-tag&#39;&gt;&lt;/a&gt; tags. Lastly the day posted is the first div inside &lt;div class=’mt4 fs-caption ..&#39;&gt;</p><p><strong>We are going to collect and display the following fields:</strong> job title, location, tags, the date posted and the url to view the job on StackOverflow.</p><h4>Let’s code</h4><pre>php artisan make:controller ScraperController</pre><p>Create an index function into our new controller</p><pre>&lt;?php</pre><pre>namespace App\Http\Controllers;</pre><pre>use Illuminate\Http\Request;<br>use App\Services\ScraperService;</pre><pre>class ScraperController extends Controller<br>{<br>    /**<br>     * Get all the jobs openings at a specified url<br>     */<br>    public function index(ScraperService $scraperService)<br>    {<br>        $url = &#39;<a href="https://stackoverflow.com/jobs?l=South+Africa&amp;d=20&amp;u=Km&#39;">https://stackoverflow.com/jobs?l=South+Africa&amp;d=20&amp;u=Km&#39;</a>;<br>        <br>        $data = $scraperService-&gt;scrap($url);</pre><pre>return view(&#39;welcome&#39;, $data);<br>    }<br>}</pre><p>The url we will be scraping is <a href="https://stackoverflow.com/jobs?l=Kenya&amp;d=20&amp;u=Km">https://stackoverflow.com/jobs?l=South+Africa&amp;d=20&amp;u=Km</a>. Please feel free to replace the location parameter with your desired location like <a href="https://stackoverflow.com/jobs?l=Kenya&amp;d=20&amp;u=Km">https://stackoverflow.com/jobs?l=Kenya&amp;d=20&amp;u=Km</a> or you can use the generic url <a href="https://stackoverflow.com/jobs?l=Kenya&amp;d=20&amp;u=Km">https://stackoverflow.com/jobs</a></p><p>Now let’s create a service to make a call to StackOverflow jobs page. The Goutte library uses a JQuery like syntax to access DOM elements. You can read more about the available methods <a href="https://symfony.com/doc/current/components/dom_crawler.html">here</a>.</p><p>Create a folder called Services in the app directory, and create a new file ScraperService.php inside that folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*aqzFYhBiLWZm7ZsV-fn2uQ.png" /></figure><p>Add the following content to the file:</p><pre>&lt;?php</pre><pre>namespace App\Services;</pre><pre>use Goutte\Client;<br>use Symfony\Component\HttpClient\HttpClient;</pre><pre>class ScraperService<br>{<br>    /**<br>     * Make a call to to specified url and return formatted data<br>     * <br>     * <a href="http://twitter.com/param">@param</a> string $url<br>     * <br>     * <a href="http://twitter.com/return">@return</a> array<br>     */<br>    public function scrap($url)<br>    {<br>        $client  = new Client(HttpClient::create([&#39;timeout&#39; =&gt; 60]));<br>        $crawler = $client-&gt;request(&#39;GET&#39;, $url);</pre><pre>       //Get the job title<br>        $titles = $crawler-&gt;filter(&#39;.listResults h2&#39;)-&gt;each(function ($node) {<br>            return $node-&gt;text();<br>        });<br>        <br>        //Get the link to view a specific job details<br>        $links = $crawler-&gt;filter(&#39;.listResults a.s-link&#39;)-&gt;each(function($node){<br>            $href  = &#39;<a href="https://stackoverflow.com&/#39;">https://stackoverflow.com&#39;</a> . $node-&gt;attr(&#39;href&#39;);<br>            $title = $node-&gt;attr(&#39;title&#39;);<br>            $text  = $node-&gt;text();<br>            return compact(&#39;href&#39;, &#39;title&#39;, &#39;text&#39;);<br>        });</pre><pre>       //Get all the technical tags for each job posting<br>        $tags = $crawler-&gt;filter(&#39;.ps-relative.d-inline-block&#39;)-&gt;each(function($node){<br>            return $node-&gt;filter(&#39;a.post-tag&#39;)-&gt;each(function($nested_node){<br>                $href  = &#39;<a href="https://stackoverflow.com&/#39;">https://stackoverflow.com&#39;</a> . $nested_node-&gt;attr(&#39;href&#39;);<br>                $title = $nested_node-&gt;attr(&#39;title&#39;);<br>                $text  = $nested_node-&gt;text();<br>                return compact(&#39;href&#39;, &#39;title&#39;, &#39;text&#39;);<br>            });<br>        });</pre><pre>      //Job location<br>       $location = $crawler-&gt;filter(&#39;.listResults h3&#39;)-&gt;each(function ($node) {<br>            return $node-&gt;text();<br>        });</pre><pre>//Date posted<br>       $time = $crawler-&gt;filter(&#39;div.fs-caption div.grid--cell:first-child&#39;)-&gt;each(function ($node) {<br>            return $node-&gt;text();<br>        });</pre><pre>      return compact(&#39;titles&#39;, &#39;location&#39;, &#39;time&#39;, &#39;links&#39;, &#39;tags&#39;);<br>    }<br>}</pre><p>Let’s unpack: we make a GET request to the StackOverflow website. We then loop through the content to get the relevant information for our job listing page. As an example, crawling the content for h2 inside the listresults div will give us the job titles as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-RroqMw5sGP7-nfU-Z6uw.png" /></figure><p>Now let’s modify the welcome.blade.php. Replace its content with the content from the following gist:<strong> </strong><a href="https://gist.github.com/emygeek/b36e2fae2ae82b51319863b02ac5e6cd"><strong>Laravel Welcome blade sample with Tailwind CSS </strong></a>The most important part in the gist is the section below: we loop through the data received from our controller and display it in the appropriate placeholders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqH1Y_uLSgUlXtZRRz5pCw.png" /></figure><p>Lastly edit the web.php file inside the routes folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zV1QKK_5LIUPkDN0FUWv4g.png" /></figure><p>Run php artisan serve and you should see the jobs listed like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECMH3_jr9DRKQtRhUEHa3A.png" /></figure><p>I hope you enjoyed this article. You can find below other PHP libraries for scraping.</p><h4>Additional resources:</h4><p><a href="https://github.com/spatie/crawler">https://github.com/spatie/crawler</a> A php web crawler by the Spatie team</p><p><a href="https://github.com/dweidner/laravel-goutte">https://github.com/dweidner/laravel-goutte</a> A Laravel based package built on top of Goutte.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beca3ca98651" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/web-scraping-101-lets-build-a-curated-list-using-laravel-7-and-tailwind-css-beca3ca98651">Web Scraping 101: Let’s Build a Curated List Using Laravel 7 and Tailwind CSS</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use UUIDs instead of auto-increment IDs in your Laravel app]]></title>
            <link>https://emymbenoun.medium.com/how-to-use-uuids-instead-of-auto-increment-ids-in-your-laravel-app-2e6cc045f6c1?source=rss-cfafb589c824------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e6cc045f6c1</guid>
            <category><![CDATA[laravel-passport]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[uuid]]></category>
            <category><![CDATA[laravel-7]]></category>
            <category><![CDATA[migration]]></category>
            <dc:creator><![CDATA[Marie Mbenoun]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 00:32:39 GMT</pubDate>
            <atom:updated>2021-01-24T21:52:25.795Z</atom:updated>
            <content:encoded><![CDATA[<p>UUIDs (Universally Unique Identifier) are 128 bits values, used to uniquely identify the table records. They are commonly represented as a hexadecimal string split into five groups separated by hyphens. A typical example looks like:</p><pre>116c34de-3dcb-44bc-9511-a48242b9aaab</pre><p>The point of this article is not to address the advantages or disadvantages of using UUIDs, but to see how to implement them in a Laravel app and update any foreign key based on a UUID column. For the purpose of this article, we are going to be using Laravel 7.x, but this can work on any other version of Laravel (Tested on 5.8 and 6.x). You can get the source code of this tutorial <a href="https://github.com/emygeek/laravel-uuid-boilerplate">here</a>.</p><p>Let’s start by creating a new Laravel app called laravel-uuid-demo.</p><pre>composer create-project --prefer-dist laravel/laravel laravel-uuid-demo</pre><p>This will create a new app with the latest Laravel version. If you want to specify a Laravel version, add the version number at the end like:</p><pre>composer create-project --prefer-dist laravel/laravel your-project-name &quot;7.0.*&quot;</pre><p>We are going to use the <a href="https://github.com/ramsey/uuid">Ramsey UUID</a> library, which is a package that helps generate universally unique identifiers.</p><p><strong>NB: Since Laravel 5.6, Ramsey UUID is part of Laravel. No need to install it via Composer.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*06sFBIqkFaPcdQpJVSI-ew.png" /><figcaption>Image by author. Source: <a href="https://laravel.com/docs/5.6/releases#laravel-5.6">https://laravel.com/docs/5.6/releases#laravel-5.6</a></figcaption></figure><p>If you are using a version of Laravel below 5.6, run the following:</p><pre>composer require ramsey/uuid</pre><h4>Let’s get coding</h4><p>(Optional) Now let’s move the User model inside a Models folder and modify the namespace inside User.php from App to App\Models as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*UhiON41kNNlw3y24xg-y-g.png" /></figure><pre>namespace App\Models;</pre><p>Let’s create a <a href="https://www.php.net/manual/en/language.oop5.traits.php">trait</a> for the UUID so that it can be easily re-usable throughout our app (Thanks to <a href="https://dev.to/wilburpowery/easily-use-uuids-in-laravel-45be">Wilbur Powery</a> for this tip). We will import it in any Eloquent model that will require a UUID primary key. Create a new folder Traits, and create a new file Uuids.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*ZFWI4TMLyHaeYJVVFhf3Hw.png" /></figure><p>For any Laravel version from 5.6 and above, add the following code inside the Uuids.php trait:</p><pre>&lt;?php</pre><pre>namespace App\Traits;</pre><pre>use Illuminate\Support\Str;</pre><pre>trait Uuids<br>{</pre><pre>   /**<br>     * Boot function from Laravel.<br>     */<br>    protected static function boot()<br>    {<br>        parent::boot();<br>        static::creating(function ($model) {<br>            if (empty($model-&gt;{$model-&gt;getKeyName()})) {<br>                $model-&gt;{$model-&gt;getKeyName()} = Str::uuid()-&gt;toString();<br>            }<br>        });<br>    }</pre><pre>   /**<br>     * Get the value indicating whether the IDs are incrementing.<br>     *<br>     * <a href="http://twitter.com/return">@return</a> bool<br>     */<br>    public function getIncrementing()<br>    {<br>        return false;<br>    }</pre><pre>   /**<br>     * Get the auto-incrementing key type.<br>     *<br>     * <a href="http://twitter.com/return">@return</a> string<br>     */<br>    public function getKeyType()<br>    {<br>        return &#39;string&#39;;<br>    }<br>}</pre><p>NB: For any Laravel version below 5.6, use the following trait instead:</p><pre>&lt;?php</pre><pre>namespace App\Traits;</pre><pre>use Ramsey\Uuid\Uuid;</pre><pre>trait Uuids<br>{</pre><pre>    /**<br>     * Boot function from Laravel.<br>     */<br>    protected static function boot()<br>    {<br>        parent::boot();</pre><pre>static::creating(function ($model) {<br>            if (empty($model-&gt;{$model-&gt;getKeyName()})) {<br>                $model-&gt;{$model-&gt;getKeyName()} = Uuid::uuid4()-&gt;toString();<br>            }<br>        });<br>    }</pre><pre>    /**<br>     * Get the value indicating whether the IDs are incrementing.<br>     *<br>     * <a href="http://twitter.com/return">@return</a> bool<br>     */<br>    public function getIncrementing()<br>    {<br>        return false;<br>    }</pre><pre>    /**<br>     * Get the auto-incrementing key type.<br>     *<br>     * <a href="http://twitter.com/return">@return</a> string<br>     */<br>    public function getKeyType()<br>    {<br>        return &#39;string&#39;;<br>    }<br>}</pre><p>Let’s unpack it: by convention, Eloquent assumes that the primary key on a model is an <a href="https://laravel.com/docs/7.x/eloquent#eloquent-model-conventions">incrementing integer value</a>. Since we are using UUID, we need to specify that the primary key is a string, and that it’s not an incrementing value. We do it by setting the $keyType to string, and $incrementing to false. Then we override the boot function of the model to use UUID.</p><p>Now, let’s import the trait into our User model. Your imports and Use statements should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oV-3rfS1MgB0bECjTmbasg.png" /></figure><p>Next let’s transform our users migration to use UUID instead of auto-increments. Inside your CreateUsersTable migrations,</p><p>Replace</p><pre>$table-&gt;id();</pre><p>With</p><pre>$table-&gt;uuid(&#39;id&#39;)-&gt;primary();</pre><p>Now let’s run the migration: update your .env file by setting the database name, username and password. And create the database in your favourite environment. Then run:</p><pre>php artisan migrate</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJ4XzMzom_eFeW-g5LSYCA.png" /></figure><h4>Testing</h4><p>Now we are ready to test. Let’s create some fake users using factory and seeders. By default, Laravel comes bundled with a UserFactory inside database/factories. If you have placed your User model inside a Models folder, update the import statement inside your UserFactory class from</p><pre>use App\User;</pre><p>To</p><pre>use App\Models\User;</pre><p>Then let’s create a seeder.</p><pre>php artisan make:seeder UserSeeder</pre><p>In the new generated class, import the User model and inside the run() function, add:</p><pre>factory(User::class, 6)-&gt;create();</pre><p>Your UserSeeder class should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZEbnOBQrzj9r4DGBtxvHA.png" /></figure><p>Open the DatabaseSeeder class inside the seeds folder, and uncomment/modify the line that calls the UserSeeder class. Your DatabaseSeeder class should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D92TXPmbVybzU4a0hdRZqg.png" /></figure><p>Now let’s run the seeder. In your terminal, type:</p><pre>php artisan db:seed</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_feRr7chLeyt5tEOFxwXA.png" /></figure><p>That’s it. Now let’s check the Users table to see the data generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*tj6HNVsAPvgEAEB4XtSCog.png" /><figcaption>(NB: remember_token, created_at, updated_at columns not shown)</figcaption></figure><p>You can see the id column uses UUID, and not the incremented id.</p><h4>Bonus Tip:</h4><p>If you are using a UUID primary key as a foreign key in another table, you need to change the column type to uuid, where the foreign key is defined. For example: let’s assume every user has a profile. Your user_id column in the profiles table will need to change from</p><pre>$table-&gt;bigInteger(&#39;user_id&#39;)-&gt;unsigned();</pre><p>To</p><pre>$table-&gt;uuid(&#39;user_id&#39;);</pre><p>The profile migration will look something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZfVxHHExCNIPTXrtMfvaA.png" /><figcaption>(NB: the profile table primary key [id] does not need to be a UUID type.)</figcaption></figure><p>If you are building an API and using <a href="https://laravel.com/docs/7.x/passport">Laravel Passport</a> or a Roles and permission package such as <a href="https://github.com/spatie/laravel-permission">Laravel Spatie permission</a>, you will need to publish the migrations and update the user_id column type to uuid.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e6cc045f6c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>