KhoyaDev
KhoyaDev

Reputation: 115

Laravel 5.2 How to authenticate with a real mysql database

I'm new with laravel, I read the documentation of laravel, but I don't know how I make an authentication with a real mysql database. I mean, I see that there is a php migration command, but it makes a table in php and not in my database right ? Actually, I have a mysql database with a user table with login and password. I'm lost with this framework, because I never used a php framework.

Thanks !!

Edit : Excuse me, I misspoke and my problem has evolved, how did you to authenticate with a user table already exists in the database by using the Authentication service?

Upvotes: 0

Views: 700

Answers (2)

ga.breban
ga.breban

Reputation: 296

I think you might need to read again Laravel documentations.

Try the following.

  1. Make sure you have a database create in your MySql.
  2. Check again your .env for: database_host, database_name, database_user, database_password - make sure you have the right
  3. Try bellow code on your route.php

    Route::get('/', function () { if(DB::connection()->getDatabaseName()) { echo "Yes! successfully connected to the DB: " . DB::connection()->getDatabaseName(); } });

  4. If above is successful your migration should work.

Upvotes: 1

Himanshu Raval
Himanshu Raval

Reputation: 811

in .env or config>database.php you can set your database and related database connections configurations after that create migrations and run them it will create database tables in your database as per your .env or config>database.php database configurations.

Upvotes: 3

Related Questions