Laravel nova on action show page to get data from various field from user - laravel

I have one resource (User table) for which I need to perform some action.
However when that action selected I want to pass too many additional fields and selection is dynamic.
For example, if I select any user and click on action then in action I should select a category from DB and based on that category I need to get subcategory and based on that subcategory I want to get some seller on action page in Nova...
Is there any way i can do this.

I think Action Fields might help you with that. You can add additional nova fields to your collection of models before handling them in the action.
Hope that this can help: nova action fields

you can use this great NovaPackage
https://github.com/epartment/nova-dependency-container

Related

How to choose appropriate controller to handle a request in MVC?

I want to create a post so I'm using the create method of post controller. but this page has category and subcategory fields and I want to get the subcategories using AJAX.
The question is which controller is more appropriate to get the subcategories?
AJAX controller
Post controller
Category controller
If it's only one method then you should implement it in CategoryController because maybe other entities of your project will have relations with categories. It doesn't make sense to query route to PostController to get categories for select on, let's say, user category permissions editing page.
But if you need a bunch more methods it would be better to delegate a separate CategoryApiController for different AJAX methods and group it's routes separately too.

Show only active records in lookup - CRM

I have custom entity which has lookup to the Products entity record.
I want this field to show only active(status) Products.
How can I do this? am I supposed to make new lookup view in Products, change existing one, or something else?
You should pick the view you'd like to render the records from. Navigate to form customizations, and edit the field property to look like below:

Orchard Ajax Request

Currently we have a few products defined in Orchard.
We managed do display these products by using a query in combination with projection.
I executed the same steps as described in this tutorial, Defining and rendering the ProductCatalog Content Type
There is also a menu to navigate inside products catalog. When selecting category, the full page is refreshed. How can we implement a ajax request each time user select a product category in menu?
Here i will show you an example of the screen:
I guess your best bet is to do something along those lines:
Create a module with a custom ApiController
Write an alternate for your category navigation in which you send an ajax request to your controller
Use IContentManager in your controller to query for your products and return them as a json result
Update your page from your result

Magento. Redirect to specific store view

We have multi-website(5) multi-store-view(13) shop.
What we need is that only 3 store view from 1 shop are allowed to checkout. Therefore the problem is how to redirect users from other shops to the same products on specified store view.
For example user watches product on mk_nn_eng and click #Button#, after that he is redirected to mu_aa_ENG AND sees the same product, he was observing but on specified store view.
How to perform such redirect?
If it's the same item, it will have the same id. And you can link to an item by it's id using the format (assuming you have different domains set up for each view):
www.DomainForStoreViewYouWant.com/catalog/product/view/id/{{product.id}}
Where you would get the id with something like $product->getId(); depending on the product object in the file you're looking at.
So the button you mentioned would just be the above link.
Is this what you had in mind?
Update:
If it's the same domain for each view, you could add the storecode to the end: ?___store=storecode

Do I need a model or view model? MVC 3

I have a pretty standard scenario where I have a model which in this case is a product.
The product model has a load of properties such as price, desc etc which I want to display on a view.
I have this working fine.
The product has a list of accessories objects which get displayed on the view and gives the user the ability to enter a qty for that accessory.
When the user clicks add to basket I only actually need the list of accessories and the id of the parent product.
Should I be creating a view model that contains all the product info I need or do I just pass my view the product and then on submit just get a view model for the few fields that I need in the signature of the function?
I'm new to mvc in case you hadn't guessed!! and I am using MVC 3.
Using a separate view model is better practice as it means you can add extra information outside of the Product which may be relevant such as Basket and User info. If you have many fields on the product then you can use Automapper to take the relevant fields and map them to the view model. Also you can flatten the model if necessary and make serverside queries which fecth all of the model's related items such as Category info etc.
Take a look at Automapper here:
http://lostechies.com/jimmybogard/2009/01/23/automapper-the-object-object-mapper/
once you start using it you won't look back.
The academic way would be to crete a separate ViewModel class with just the data you need in the view.
But when you are comfortable with ignoring the extra fields in your class i think its absolutely ok to use your Product model class in the view.

Resources