<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shishir Bhuiyan</title>
    <description>The latest articles on DEV Community by Shishir Bhuiyan (@engrshishir).</description>
    <link>https://dev.to/engrshishir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1275532%2F9d729ef2-4930-4e2b-b13f-9edcc888aa40.jpeg</url>
      <title>DEV Community: Shishir Bhuiyan</title>
      <link>https://dev.to/engrshishir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/engrshishir"/>
    <language>en</language>
    <item>
      <title>Laravel Authentication</title>
      <dc:creator>Shishir Bhuiyan</dc:creator>
      <pubDate>Sat, 24 Feb 2024 17:37:20 +0000</pubDate>
      <link>https://dev.to/engrshishir/laravel-authentication-1ehj</link>
      <guid>https://dev.to/engrshishir/laravel-authentication-1ehj</guid>
      <description>&lt;p&gt;*&lt;em&gt;Main Source : *&lt;/em&gt;&lt;a href="https://laravel.com/docs/9.x/authentication#authenticating-users"&gt;https://laravel.com/docs/9.x/authentication#authenticating-users&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Laravel offers several packages related to authentication. Before continuing, we'll review the general authentication ecosystem in Laravel and discuss each package's intended purpose.&lt;/p&gt;

&lt;p&gt;First, consider how authentication works. When using a web browser, a user will provide their username and password via a login form. If these credentials are correct, the application will store information about the authenticated user in the user's session. A cookie issued to the browser contains the session ID so that subsequent requests to the application can associate the user with the correct session. After the session cookie is received, the application will retrieve the session data based on the session ID, note that the authentication information has been stored in the session, and will consider the user as "authenticated".&lt;/p&gt;

&lt;p&gt;When a remote service needs to authenticate to access an API, cookies are not typically used for authentication because there is no web browser. Instead, the remote service sends an API token to the API on each request. The application may validate the incoming token against a table of valid API tokens and "authenticate" the request as being performed by the user associated with that API token.&lt;/p&gt;

&lt;p&gt;Laravel includes built-in authentication and session services which are typically accessed via the Auth and Session facades. These features provide cookie-based authentication for requests that are initiated from web browsers. They provide methods that allow you to verify a user's credentials and authenticate the user. In addition, these services will automatically store the proper authentication data in the user's session and issue the user's session cookie.&lt;br&gt;
The attempt method accepts an array of key / value pairs as its first argument. The values in the array will be used to find the user in your database table. So, in the example above, the user will be retrieved by the value of the email column. If the user is found, the hashed password stored in the database will be compared with the password value passed to the method via the array. You should not hash the incoming request's password value, since the framework will automatically hash the value before comparing it to the hashed password in the database. An authenticated session will be started for the user if the two hashed passwords match.&lt;/p&gt;

&lt;p&gt;Remember, Laravel's authentication services will retrieve users from your database based on your authentication guard's "provider" configuration. In the default config/auth.php configuration file, the Eloquent user provider is specified and it is instructed to use the App\Models\User model when retrieving users. You may change these values within your configuration file based on the needs of your application.&lt;/p&gt;

&lt;p&gt;The attempt method will return true if authentication was successful. Otherwise, false will be returned.&lt;/p&gt;

&lt;p&gt;The intended method provided by Laravel's redirector will redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware. A fallback URI may be given to this method in case the intended destination is not available.&lt;br&gt;
Link : &lt;a href="https://laravel.com/docs/9.x/authentication#authenticating-users"&gt;https://laravel.com/docs/9.x/authentication#authenticating-users&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

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

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    /**
     * Handle an authentication attempt.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function authenticate(Request $request)
    {
        $credentials = $request-&amp;gt;validate([
            'email' =&amp;gt; ['required', 'email'],
            'password' =&amp;gt; ['required'],
        ]);

        if (Auth::attempt($credentials)) {
            $request-&amp;gt;session()-&amp;gt;regenerate();

            return redirect()-&amp;gt;intended('dashboard');
        }

        return back()-&amp;gt;withErrors([
            'email' =&amp;gt; 'The provided credentials do not match our records.',
        ])-&amp;gt;onlyInput('email');
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Accessing Specific Guard Instances
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://laravel.com/docs/9.x/authentication#accessing-specific-guard-instances"&gt;https://laravel.com/docs/9.x/authentication#accessing-specific-guard-instances&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Authenticate A User Once
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://laravel.com/docs/9.x/authentication#authenticate-a-user-once"&gt;https://laravel.com/docs/9.x/authentication#authenticate-a-user-once&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Invalidating Sessions On Other Devices
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://laravel.com/docs/9.x/authentication#invalidating-sessions-on-other-devices"&gt;https://laravel.com/docs/9.x/authentication#invalidating-sessions-on-other-devices&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
    </item>
    <item>
      <title>Font Awesome 5 use social/brand icons in React</title>
      <dc:creator>Shishir Bhuiyan</dc:creator>
      <pubDate>Mon, 12 Feb 2024 07:59:56 +0000</pubDate>
      <link>https://dev.to/engrshishir/font-awesome-5-use-socialbrand-icons-in-react-51jb</link>
      <guid>https://dev.to/engrshishir/font-awesome-5-use-socialbrand-icons-in-react-51jb</guid>
      <description>&lt;p&gt;&lt;code&gt;npm i --save @fortawesome/fontawesome-svg-core&lt;br&gt;
npm install --save @fortawesome/free-solid-svg-icons&lt;br&gt;
npm i --save @fortawesome/free-brands-svg-icons &lt;br&gt;
npm install --save @fortawesome/react-fontawesome&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {  faFacebookF , } from '@fortawesome/free-brands-svg-icons';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;FontAwesomeIcon icon={faFacebookF} /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Optional parameter in react functional Component</title>
      <dc:creator>Shishir Bhuiyan</dc:creator>
      <pubDate>Thu, 08 Feb 2024 14:56:59 +0000</pubDate>
      <link>https://dev.to/engrshishir/optional-parameter-in-react-functional-component-419n</link>
      <guid>https://dev.to/engrshishir/optional-parameter-in-react-functional-component-419n</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';

const MyComponent = ({ optionalParam = 'Default Value' }) =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;p&amp;gt;{optionalParam}&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default MyComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Answer: ReactJS and images in public folder</title>
      <dc:creator>Shishir Bhuiyan</dc:creator>
      <pubDate>Wed, 07 Feb 2024 20:50:41 +0000</pubDate>
      <link>https://dev.to/engrshishir/answer-reactjs-and-images-in-public-folder-4an6</link>
      <guid>https://dev.to/engrshishir/answer-reactjs-and-images-in-public-folder-4an6</guid>
      <description>&lt;p&gt;You don't need any webpack configuration for this.&lt;br&gt;
&lt;code&gt;&amp;lt;img src="/image.jpg" alt="image" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To reference images in public there are two ways I know how to do it straight forward. &lt;br&gt;
&lt;code&gt;&amp;lt;img src={process.env.PUBLIC_URL + '/yourPathHere.jpg'} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/47196800/reactjs-and-images-in-public-folder"&gt;Reference : https://stackoverflow.com/questions/47196800/reactjs-and-images-in-public-folder&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Answer: How to import a CSS file in a React Component</title>
      <dc:creator>Shishir Bhuiyan</dc:creator>
      <pubDate>Wed, 07 Feb 2024 18:08:16 +0000</pubDate>
      <link>https://dev.to/engrshishir/answer-how-to-import-a-css-file-in-a-react-component-208g</link>
      <guid>https://dev.to/engrshishir/answer-how-to-import-a-css-file-in-a-react-component-208g</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AoTUKOcU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/39853646/how-to-import-a-css-file-in-a-react-component/39853739#39853739" rel="noopener noreferrer"&gt;
            &lt;span class="title-flare"&gt;answer&lt;/span&gt; re: How to import a CSS file in a React Component
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Oct  4 '16&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/39853646/how-to-import-a-css-file-in-a-react-component/39853739#39853739" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oeieW07A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          52
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h2-sXgSn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;I would suggest using CSS Modules:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import React from 'react';
import styles from './table.css';

export default class Table extends React.Component {
    render () {
        return &amp;lt;div className={styles.table}&amp;gt;
            &amp;lt;div className={styles.row}&amp;gt;
                &amp;lt;div className={styles.cell}&amp;gt;A0&amp;lt;/div&amp;gt;
                &amp;lt;div className={styles.cell}&amp;gt;B0&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Rendering the Component:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div class="table__table___32osj"&amp;gt;
    &amp;lt;div class="table__row___2w27N"&amp;gt;
        &amp;lt;div class="table__cell___2w27N"&amp;gt;A0&amp;lt;/div&amp;gt;
        &amp;lt;div class="table__cell___1oVw5"&amp;gt;B0&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;…
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/39853646/how-to-import-a-css-file-in-a-react-component/39853739#39853739" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
  </channel>
</rss>
