laravel passport not working in laravel 5.8 - php

I am trying to install laravel passport in my laravel 5.8 website to implement oauth2 and access token for API requests. I ran this command composer require laravel/passport but i getting error and i knew Latest version of Laravel Passport dropped support for Laravel 5.8, so i tried installing earlier passport version with this command composer require laravel/passport:7.5.1 , now i installed but then when i run next command php artisan migrate i get following error -
Migrating: 2016_06_01_000001_create_oauth_auth_codes_table
Illuminate\Database\QueryException : SQLSTATE[HY000]: General
error: 1364 Field 'id' doesn't have a default value (SQL: insert into
migrations (migration, batch) values
(2016_06_01_000001_create_oauth_auth_codes_table, 2))
I checked database and saw only one table created oauth_auth_codes, After the error i did not proceed further with the command php artisan passport:install.
So what steps i take to install laravel passport in my laravel 5.8 website with all required tables??. So that i implement oauth2 server and tokens when request comes to my laravel site API endpoints. Plase answer with details, It's a tough project i am having right now.

With Laravel 5.8 version, installing passport as per laravel documentation https://laravel.com/docs/5.8/passport#introduction will not be completed. Things that you need to have for successful running of passport on laravel 5.8 , please follow the following steps:
Install Passport (you had did it already) using:
composer require laravel/passport:7.5.1.
Now Before migration : put below code into composer.json as:
"paragonie/random_compat": "2.*" .
You can see in below picture as well.
Now, You need to write in terminal as :
composer update (now you are good to go).
now, php artisan migrate.
php artisan passport:install
Thank you. I am sure it will work for you. :)

Related

Laravel 8.X - How to generate auth files/scaffolding in the absence of make:auth command

I am trying to port a legacy/joomla code into larvel framework. I am trying to reuse old database tables with laravel 8.16. I have added the following columns in the existing users table
created_at,
updated_at,
remember_token
Now, when i try to run 'php artisan make:auth'. The command is not available. What should I do or which command should I use to create scaffolding?
Laravel UI installation
At first, install laravel ui by running below command
composer require laravel/ui
Add UI scaffolding
You can add ui view by running:
php artisan ui:auth
And add authentication controllers by running
php artisan ui:controllers

Laravel Passport not able to install on laravel 5.4.*

Hi I am new to laravel and trying to install the Laravel passport on an existing laravel project. I am trying to run this command
composer require Laravel/passport
When I run the command it shows nothing to install or update. But, I can see that in my composer I have Laravel version ~4.0 and I am using PHP7.1. I have also installed one of its dependency illuminator/encryption=5.4.36.
Can somebody help me out? How to install my Laravel passport?
I am running laravel 5.4.36 (it's locked)
PS: Had to remove composer file content.
You have already installed Laravel Passport. Your composer / console returns that message because its already downloaded.
Your composer.json tells you that you downloaded version 4.0:
"laravel/passport": "~4.0",
Now you just have to move on I recommened going through the documentation.
There is also a nice tutorial from Taylow Otwell regarding Laravel Passport.
https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13
To get started, install Passport via the Composer package manager:
composer require laravel/passport
Next, register the Passport service provider in the providers array of your config/app.php configuration file:
Laravel\Passport\PassportServiceProvider::class,
then the command line again type:
php artisan migrate
For more info look: https://laravel.com/docs/5.4/passport

Laravel 5.4 and Mongodb 3.2 Configuration Issue

we are facing isssue in configuring Laravel 5.4 with Mongodb 3.2. We have done follow things but still we are facing issue in this project, it would be great if i will get solution for this
Installed Composer & Install Laravel 5.4
Install Package composer require mongodb/mongodb and composer require jenssegers/mongodb ^3.2.
we have also add mongodb in our php7.1 (http://mazau.com/info.php)
Default database driver to : mongodb (database.php and .env file)
We have also provide proper database credentials and user details.
We are not facing issue in any of above issue at present. But when we try to execute php artisan migrate we face below error.
[Symfony\Component\Debug\Exception\FatalErrorException] Class ‘PDO’
not found
can anyone please help me on this ?

Laravel voyager migration issue

I am working on windows and WAMP. I installed Laravel 5.4 within cmd and that was successful. After that I follow laravel voyager installation process and that was successful too.
Afterwards I checked /migrations/ folder and there are many tables for migration, for laravel itself and for voyager, but when I type php artisan migrate in cmd it migrate only "users" table, it ignored other tables so voyager is not working and showing errors that tables are missing.
I searched internet but could not find this type of issue.
I'm using mysql
In the Voyager documentation it says the following:
Before installing Voyager make sure you have installed one of the following versions of Laravel:
Laravel 6
Laravel 7
Laravel 8
Additionally Voyager requires you to use PHP 7.3 or newer.
Apparently with Laravel 5.4 it will not work .
To use Voyager on Laravel 5.x, you need to use version 1.3 of Laravel Voyager: https://github.com/the-control-group/voyager/tree/1.3
Remembering that it is not necessary to use the migrate command for Voyager to work.
The steps are:
composer require tcg/voyager
Next step you must create your database and insert your credentials in the .env file
You can choose to install Voyager without dummy data or with dummy data. For an installation without a dummy data, run the command:
php artisan voyager:install
For a dummy data installation:
php artisan voyager:install --with-dummy
You will need to access the url http://localhost:8000/ admin to access the voyager, if you installed with dummy data, you will have a super user created, with the following credentials:
email: admin#admin.com
password: password
If you have not created any dummy users, you can set an existing user in your database as admin by running the command:
php artisan voyager:admin your#email.com
Or you can create a new admin user, using the command:
php artisan voyager:admin your#email.com --create

How to install aimeos in laravel 5.1?

I am new with laravel. I have no idea how to install aimeos in laravel 5.1, since the installation guide for laravel 5.0, there is a different service provider in between L5 and L5.1.
I got this error:
C:\xampp\htdocs\classic>composer require aimeos/aimeos-laravel
Using version ^1.0 for aimeos/aimeos-laravel
./composer.json has been updated
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Aimeos\Shop\ShopServiceProvider' not found
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
Please help me.
There's no difference between Laravel 5.0 and 5.1 when installing the Aimeos web shop package:
https://aimeos.org/docs/Laravel/Install_Aimeos
Update:
There seems to be a problem due to a recent change in Laravel 5.1.x because the service provider is now used before composer installs the package. I've fixed this in my test installation by
removing the the provider from config/app.php
removing the Aimeos related artisan commands in the "scripts" section of the composer.json file
running "composer update" afterwards with the aimeos-laravel package as requirement
executing the artisan tasks ("vendor:publish", "migrate", "aimeos:setup", "aimeos:cache") afterwards by hand
Download https://github.com/aimeos/aimeos-laravel.
place package to root or desired folder and while updating the composer set
"require": {
.......
"laravel/framework": "^5.1.11",
......
}
then brows
https://aimeos.org/docs/Laravel/Install_Aimeos#Laravel_5.0.2F5.1_and_Aimeos_1.0 Link and follow the instructions.

Categories