Uuid-3.0 is not working with laravel 5.5
lakshmaji opened this issue · 7 comments
Uuid is not found
error when trying to generate uuid from the controller
Uuid::generate(4);
Environment details
- Laravel 5.4
- PHP 7.1
- Uuid 3.0
Multiple contradications in your issue report:
- Title states Laravel 5.5, description states 5.4
- Title states UUID version 3, example uses UUID version 4
Can you clarify?
Latest version works in both laravel 5.4 and 5.5.
Like @BenExile, can you explain a bit more what you are trying to do?
Yeah that was a typo, Thanks @BenExile and the Laravel version I'm using was 5.5
- Currently I'm using
Webpatser\Uuid\ Uuid::generate(4)
, No issues with this. - But why can't I simply use
Uuid
with help of facades in my controller class, like as illustrated below
Uuid:: generate(4)
You don't need to use a facade to do this. Just import the Uuid
class as you would with any other class:
use Webpatser\Uuid\Uuid;
$uuid = Uuid::generate(4);
@BenExile , Yeah I'm using this, it worked for me, But why can't simply use with facade aliases (that are automatically registered with laravel, ie., auto package discovery), like below
use Uuid;
Uuid::generate(4)
Instead of
use Webpatser\Uuid\Uuid;
$uuid = Uuid::generate(4);
If you really want to use a Facade for blade directives/whatever, you can paste this line in the Facades array at the end of your config/app.php
'Uuid' => Webpatser\Uuid\Uuid::class,
And then you should be able to use it as so
Uuid::generate();
@hightekjonathan , Yeah that's right. but this package has enabled package auto discovery
. So it it is not required to register facades
manually. Am I missing anything here