Giter Club home page Giter Club logo

Comments (5)

EmadAdly avatar EmadAdly commented on August 28, 2024 1

@danherd
already have a validation uuid LC34
Your PR is Merged

from laravel-uuid.

EmadAdly avatar EmadAdly commented on August 28, 2024

@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.

danherd avatar danherd commented on August 28, 2024

http://jsonapi.org/format/#crud-creating-client-ids

from laravel-uuid.

danherd avatar danherd commented on August 28, 2024

Could potentially add this check to make sure the UUID supplied is 'valid':

https://gist.github.com/joel-james/3a6201861f12a7acf4f2

from laravel-uuid.

lintburger avatar lintburger commented on August 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.