Comments (5)
@danherd
already have a validation uuid LC34
Your PR is Merged
from laravel-uuid.
@danherd
Users must never be able to generate their own UUID nor can they override them or trying to change the UUID,
This may lead to a bug in your project. I would not recommend it.
However, you can explain to me why user entering UUID by manually may be i can to solve it better. Or as a last solution can pass your proposal as an option.
from laravel-uuid.
http://jsonapi.org/format/#crud-creating-client-ids
from laravel-uuid.
Could potentially add this check to make sure the UUID supplied is 'valid':
https://gist.github.com/joel-james/3a6201861f12a7acf4f2
from laravel-uuid.
@danherd @EmadAdly
I've setup a project using 'id' as my primary key, which I've successfully setup to autogenerate UUIDs using this package. It works great when I use ::create($request->all()) in the store(Request $request) method of my controller.
I have an API use case where I want to supply the 'id' in the incoming json $request. Despite supplying it in the $request, this package generates a new UUID anyway, and stores it in the 'id' column. (I do not have 'id' in my $guarded array.) I cannot seem to set it on ::create or update it on ::update.
Is there some trick to enabling the functionality of this PR?
Model:
class Game extends Model
{
use Uuids;
public $incrementing = false;
protected $fillable = [
'id', 'location_id', 'gamenight_id', 'user_id', 'notes',
];
Controller:
public function store(Request $request)
{
$game = Game::create($request->all());
return response()->json($game, 201);
}
PS: thanks for your work on this!
from laravel-uuid.
Related Issues (20)
- Checking whether a record with generated Uuid exists HOT 7
- uuid is not saved when using model observer HOT 3
- uuid is not saved with pivot HOT 5
- Automatitly generate uuid for an existing table HOT 2
- Can not work in Laravel 5.7 HOT 1
- Laravel 5.7 & UUID HOT 7
- Laravel 5.8 HOT 1
- Laravel 6 HOT 1
- Add support laravel 6.2 up HOT 1
- Insert the autoincrement ID in the foreign keys instead of the UUID
- Documentation suggests both unique and primary index on the id column HOT 1
- Creating new record manually setting primary UUID HOT 1
- Support for laravel 7.0 HOT 2
- Note about casting the UUID when using Auth
- Auto discovery features issues
- PHP 8 support HOT 3
- Pipeline failed for PHP8 support HOT 1
- Laravel 9 Support HOT 1
- Laravel 9 update not published HOT 2
- Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed in /var/www/app/PRS_System_V3/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 1036 and exactly 2 expected
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 laravel-uuid.