dimanche 29 novembre 2015

Using middleware for table manipulation laravel 5.1

Currently I am developing a small to middle level application in laravel I came across middleware in laravel, My question is Can i use middleware for making changes in my table for eg, In my application(Canteen Management System), When user orders something from the menu and make request for order then before inserting the order into the model table i want to subtract the order amount from his balance. Reason i am thinking of doing this is because balance attribute is a part of user table and order amount is another part of Order table and i am not being able to develop any data relation between them (but I derive many to one relation between them). So i am not thinking of doing only this thing using data relationship , So that's when i come accross middleware. So help me about this, also Can i use two model in one controller function ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1YBjus1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire