Comments (9)
follow this steps take note of step 2.
1: add this Diadal\Passport\PassportServiceProvider::class,
to providers
in config/app.php
2: add this \Laravel\Passport\Passport::ignoreMigrations();
to public function register()
in app/Providers/AppServiceProvider.php
3: run php artisan config:clear
4: run php artisan vendor:publish --tag=passport-cilent-migrations
from passport.
Hi @diadal , followed the steps below, and I think that the migrations aren't published because
I'm using laravel 5.6 upgraded from 5.5
So I've installed new, fresh laravel and the migration was published.
but still got some issues after running passport install. like the screenshot below
Another question do I have is regarding the migrations, after publishing, should I update the id's to uuid, or just keep as default?
Please let me know how to get out of the error as the screenshot describe, it regarding Emadadly trait inside your source code like below.
from passport.
upgrade your laravel from 5.5 to 5.6 is not the issue
https://github.com/webpatser/laravel-uuid
create config/uuid.php
file
composer require "webpatser/laravel-uuid:^3.0"
Discovered Package: webpatser/laravel-uuid
Next change the default config in config/uuid.php
to 'default_uuid_column' => 'id',
if you dont have uuid.php in your config folder create 1
if you run this php artisan vendor:publish --tag=passport-cilent-migrations
you dont need to edit migration files
from passport.
Hi @diadal, I didn't test well, but now I got php artisan passport:install
passed, after having to install composer require emadadly/laravel-uuid
.
So the last question I have is about 'default_uuid_column' => 'id',
, will this force all my models to have id as default column or I can keep other models with uuid
.
The reason behind is because on my BaseModel, I got something different like below
`<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Webpatser\Uuid\Uuid;
use Illuminate\Database\Eloquent\Builder;
class BaseModel extends Model{
public $incrementing = false;
public static function boot() {
parent::boot();
static::creating(function($model) {
// Only generate the uuid if the field actually is called uuid.
// For some system models a normal id is used (e.g. language)
if($model->getKeyName() == 'uuid'){
$model->{$model->getKeyName()} = (string)$model->generateNewId();
}
});
static::addGlobalScope('order', function (Builder $builder) {
$builder->orderBy('created_at', 'desc');
});
}
/**
* Get a new version 4 (random) UUID.
* @return Uuid
*/
public function generateNewId()
{
return Uuid::generate(4);
}
}
`
So I'm worried about the config uuid.php file to affect other models.
from passport.
no it will not affect other models if you need uuid in ID you need to define in your migration
$table->uuid('id')->unique(); $table->primary('id');
and declare public $incrementing = false;
in your models
from passport.
This won't be an easy task to accomplish, because I already have too many models, and all of them i just extends the base model, and inside a model, I declare primary key as uuid.
Something like the screenshot below.
And all migrated tables as uuid
as primary key, to undo it to id
, it will be just a mess for all project for now.
I will have to play around on weekend to find a better workaround solution.
from passport.
you dont get the point you dont need to change anything webpatser/laravel-uuid
will not change anything in your data table without you asking it to do so
from passport.
Oh, Okay, that's cool.
But either way, I will let u know after testing everything nicely.
Thanks for your help
from passport.
yeah when you run test let me know if any issue
from passport.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passport.