GithubHelp home page GithubHelp logo

auth-in-laravel's Introduction

Auth in laravel

Installation

git clone <url> 
cd Auth-in-Laravel
composer install
npm i

or

bun install

How Lunch Tp

  1. Migrate the DB files into your DB
php artisan migrate
  1. Also Seed some Fake Data into you Tables using this commande:
php artisan db:seed --class=PostSeeder
  1. for Lunch The App use this commande to create listen port
php artisan serve
  1. create a user in http:/localhost:8000/register
  2. add some posts for this user using Auth::id()
    1. You can inserted them in you DB manuelle or use php artisan tinker for add post for your user using ORM(Elequont).
    2. after that you can see in http://127.0.0.1:8000/dashboard/posts all posts for that user

19-04-2024

  • web.php int this file you can see in line 40 & 43 the two routes you will use for the test this exercices.

Tp1 /send-email

first config you app in .env change the mail driver to mailtrap

MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="[email protected]"

second in this file Controller you can see the function sendEmail that will send an email to the user with the order details. change the email for test this function.

    public function sendEmail()
    {
        Mail::to('<email>')->send(new OrderShip(Auth::id(), Auth::user()->name, Auth::user()->email));
        echo 'good, email sent successfully!';
    }

for the body of the email you can modify it in this file view body of the email

finally enter this route will send email for you address

http:/localhost:8000/send-email

for Tp2 /notify

i guess you have already config you app for the email so this time all files are ready for you you should just search for the user that have your email for test it in this file Notification controller

or you can notify all users using this code

    public function testN(){
        $users = User::get();
        Notification::send($users, new test());
    }

http:/localhost:8000/notify

for Tp3 / Events / Listening

just try to create new user and this user will had an email when he register if you have some trouble for test email service in your app go to mailtrap.io and create an account and get the SMTP credentials and change the .env file with the new credentials

auth-in-laravel's People

Contributors

rep007 avatar eren-yeager13 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.