Fields from another table in Laravel Nova - laravel-nova

Laravel Nova 3.8. How can I create a new fields in a resource that will be saved to another table when the resource is updated? Without creating a second resource. Is it possible? Didn't find this in the documentation

You can declare fields in resource and after that use YourModelObserver saving method to create some data in another table from request

Related

Proper way of using Marten for ASP.NET MVC/Core

I just discovered Marten today and currently trying to learn on how to use this properly.
For creating new records, it can be as straight forward as providing a blank form/view then during submission - just open a new session then perform the saving like this:
using (var session = _documentStore.LightweightSession())
{
session.Store(model);
session.SaveChanges();
}
But how about the updating existing records? After fetching the record and displaying it on the form, is it fine to just use the same code as I used above or is there another way? The only example I found for updating is loading the record from session by calling Load() method then editing the properties, after that is calling the SaveChanges() method of the session used.
Marten tracks documents using the document identity. The Id can be either a public field or property, and the name must be either id or Id or ID.
Quote from the doc:
Marten's .Net API makes no distinctions between inserts and updates.
The Postgresql functions generated by Marten to update the document
storage tables perform "upserts" for you. Anytime a document is
registered through IDocumentSession.Store(document), Marten runs the
"auto-assignment" policy for the id type of that document. See
Document Identity for more information on document id's.
This means that you don't necessarily need to load a document before updating it. If you know its identity value, you could simply change some property on the document and call IDocumentSession.Store(document) which will perform an update if a document with this id already exists in the datastore.

Backendless: How to load only the data which belongs to the currently logged in user

I have two tables which has "photo URL" columns, that contain same image URL. So when I change value in one table, I would like the value in another to update automatically. So how can I set this relationship in Backendless? Like foreign key in SQL.
EDIT:
I have included Users table as property of ActionCreation table. Users have property for URL of logo for the user. In ActionCreation table I need to have exactly the same photo URL. When I included Users as property of ActionCreation, there is no custom properties are loaded form Users object. But I need access photo URL in my app. What the best way to do it?
Thank you.
Is there a relationship between the tables?
How does the same value get into two tables? Do you write it there twice?
Mark

Creating Dynamic model and store in sencha touch

I want to create dynamic model in Sencha from a xml file that contains the fields.Please tell me how to create a dynamic model and register it in app.js and if you can post Any sample application it would be a kind help.
You can create a store to read the fields form the xml file.
Then you can create a model with fields you loaded.
Last, create a store to read by the model.

Assigning object IDs with rails

Suppose I have a client side app that sends out requests to a rails back end. One of those requests would to create a new object, say a Post. In this case the client side app sends in a json request containing a post title and the post content.
But now suppose that the object needs to have an id as well, which the client side app doesn't provide. Is there a way for rails to automatically increment the previously created post's id and set the newly created objects id to this value?
Would I put this into the create method of PostsController? Or does this sort of logic belong in the model file?
Typically this is done at the database level. The tables rails generated for you will by default have an auto incrementing id column

How to add a temporary field to my devise form to use later?

I want to give users the option of registering as a specified kind of user. The user type field however is in a separate table (for security reasons) so when I create a new account I also create a new record in the other table for that account.
So as far as I can tell, I can either create a new field in my devise created user table and then after_create have my model check for that field and then add it to my associated user permissions table. But that seems redundant, so is there a way to add some sort of temporary variable to the form and use that to create the user type?
When you want to create/edit two or more objects in the same form then you should user nested forms. You will find all necessery information in this two railscasts: http://railscasts.com/episodes/196-nested-model-form-part-1 and http://railscasts.com/episodes/197-nested-model-form-part-2

Resources