Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Christopher Thomas
    @christhomas
    hmm, in the controller, how do I get the response that the middleware was processing?
    I thought that response() would rturn it
    then if I called response()->json([...something]), it would put a json body inside it, but seems it creates a new json response and it's not related to the original one
    NikitaBazhenovb
    @NikitaBazhenovb
    Yeah, you are right.
    It's the wrong way.
    If you put body in the response json, it is like the new json data.
    So first make the data to the new val
    and put it into the response.
    Um, in my way, it is easier to use the callback function .
    Christopher Thomas
    @christhomas
    I didnt hear about this callback function? for controllers? you have a link for it?
    NikitaBazhenovb
    @NikitaBazhenovb
    Um, I don't have a link.
    I will write simple code
    Christopher Thomas
    @christhomas
    oh ok, if you don't mind, thanks
    I'm a bit stumped by the manual, things aren't very clear tbh
    NikitaBazhenovb
    @NikitaBazhenovb
    makecallback() {Put the code in here and return as the json data }
    and use this callback function to your code
    Christopher Thomas
    @christhomas
    hmm, I'm not seeing how this helps in my controller function
    NikitaBazhenovb
    @NikitaBazhenovb
    Um, could you please let me know your controller function?
    In here, upload file is available?
    Please send me your source code via drive google
    Christopher Thomas
    @christhomas
    class Controller extends Laravel\Lumen\Routing\Controller {
      public function getData() {
        return response()->json(['hello'=>'world]);
      }
    }
    Thats what my controller is doing, but I'm not sure how to get back the response from the middleware to ADD the json to it
    NikitaBazhenovb
    @NikitaBazhenovb
    Please show me your middeleware
    Christopher Thomas
    @christhomas
    brb, phone call
    NikitaBazhenovb
    @NikitaBazhenovb
    Okay
    Pedro Martins
    @pxpm
    @christhomas there is a very good package to handle cors in laravel: https://github.com/fruitcake/laravel-cors
    Ali Shikhiyev
    @Alionides
    i followed instructions as described here https://voyager-docs.devdojo.com/customization/action-buttons but there is no information how to set up new route forexample i have products and i want to add products/new route to that bread
    osieman1
    @osieman1
    I would like to use eloquent sql if possible and I have 15 models. Is it best to add use App\Models\table?; 15x in a crudcontroller, or should I use \DB instead?
    Thanks in advance
    Miika Koskela
    @mkoske
    Hello, can I somehow add entities to relation in-memory? Calling $entity->relation()->save($related) stores $related into database if I have understood correctly?
    UncertaintyP
    @UncertaintyP
    You can use $entitiy->setRelation('relation', $related)
    Mohsen
    @mohsenyz
    hey guys
    I wish to know your ideas about this pr : laravel/ideas#2451
    UncertaintyP
    @UncertaintyP
    They are two different functions. The middleware one only targets automatic authentication via remember token (the process). It is inherently different from a "normal" authenticated user (the state).
    xlcrr
    @xlcrr
    How can I delete a child relationship, without deleting the parent model?
    $photo->$category->delete(); // deletes category + photo
    Pedro Martins
    @pxpm
    $photo->dissociate($category) if your relation allow dissociate
    Sam Goody
    @SamGoody
    Hi all. I am trying to upgrade a project that uses illuminate 5.2. I am a Laravel no-nothing.
    I see that classes just dissapeared in the transition to 5.5, and cannot figure out anywhere where it says what to expect
    In 4.x (and deprecated but existing till 5.5) Config/Repository expects a FileLoader item, which is a list of the directory containing the config files. In 5.5 FileLoader is gone, and Repository expects an array. How do I know what ought to be in tat array?
    And is there some more thorough upgrade guide (the one at https://laravel.com/docs seems to skip all functions used by Laravel)
    Pedro Martins
    @pxpm
    @SamGoody my two cents on upgrading processes: https://laravelshift.com/
    I am not afiliated or work with them.
    Sam Goody
    @SamGoody
    Wow, that does look awesome. OK, will probably use that service then. Though it sure seems odd that Laravel regularly breaks everything with no docs as to how to maintain
    Pedro Martins
    @pxpm
    It's a framework on a fast moving industry. There are people behind this, people make errors. Usual stuff here. But as you can see, if there is someone selling that service it's because there is a demand in the market. Some because it's difficult, others want to spare time..
    Sam Goody
    @SamGoody
    hmm, would cost me $350 to upgrade. Not much of i was a company, but i guess laravel is not meant for the little guy
    I mean to shift. and then $18 which is fine
    This is not about errors, its about a lack of documentation. Why is there no Docs that tell me what Repository(ARRAY) is expecting? I mean, in Rails, in Node, even in CodeIgniter (which I haven't used in ages), I would never see a basic function with no docs
    Laravel has become the Rails of PHP, but its more ninja when there are no docs.
    Pedro Martins
    @pxpm
    I think you can find pretty much you are asking here: https://laravel.com/api/8.x/index.html
    notice it's the api not the docs.
    edvordo
    @edvordo
    you can also go through each version upgrade guide, I've started with laravel as 5.4, so a bit later than you, but these usually contained everything that broke or was changed to worked differently .. since you mentioned 5.2, here is probably where you want to start https://laravel.com/docs/5.2/upgrade
    unless you've already done then, of course