Code Monkey home page Code Monkey logo

Comments (6)

felixkiss avatar felixkiss commented on August 28, 2024

I don't use codeception. Can you make a example project with a simple route that uses the unique-with validator rule and a codeception test that fails? Otherwise it is really hard to remotely debug this.

Do you include the route parameter in your data array, which you pass into the validator?

from uniquewith-validator.

ovp87 avatar ovp87 commented on August 28, 2024

I wasn't passing anything into the validator, just using a normal request validator.
Issue was solved by just overwriting the request all() method, like so:

public function all()
{
        $all = Parent::all();
        $all['product_id'] = $this->route()->getParameter('id');
        return $all;
 }

Feels a bit hacky, but it works.

from uniquewith-validator.

felixkiss avatar felixkiss commented on August 28, 2024

Feels like the correct and logical approach to me. IMHO not hacky at all.

But why did it work in the browser? That seems weird to me.

from uniquewith-validator.

ovp87 avatar ovp87 commented on August 28, 2024

But why did it work in the browser? That seems weird to me.

You and me both, spent about an hour scratching my head, and still haven't figured it out.

from uniquewith-validator.

felixkiss avatar felixkiss commented on August 28, 2024

Note: normally in PHP, parent:: is used all lowercase. http://php.net/manual/en/keyword.parent.php

from uniquewith-validator.

ovp87 avatar ovp87 commented on August 28, 2024

Note: normally in PHP, parent:: is used all lowercase

Cheers 👍

from uniquewith-validator.

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.