Laravel Nova - Custom logic for Updating resources - laravel-nova

Is it possible to modify or add custom logic when you're updating,
creating and deleting resources?
If you, for example want to be able to update a subscription plan for your service through Nova but also need to send an API request to Stripe in order to update the plan there as well, how would you go about doing that?
Thanks in advance!

Since Laravel Nova is just a frontend for manipulating Eloquent models, I would do this using Laravel Events and Observers.

Related

Is it possible to use laravel nova tool for not authenticated users?

I'm trying to create custom reset password view that can include my custom field. I'm able to use this custom field for the tools that authenticated user use. The problems are, 1. How to redefine the parent layout. 2. How to prevent Nova guarding my custom routes to be able to use them by not authenticated user.
I've been researching for days trying to solve this. not sure if it solvable at all.

Best way to create admin panel in Node.JS

I had been working with Rails and used to use Active Admin to create admin panel (CRUD operations and etc)
Now I'm looking for similar package for Node.JS
Is there way to do the same as Active Admin in Node?
Thx a lot!
The best I know of are listed on our wiki. admin-on-rest has been rewritten as react-admin already. Additional notes and comparison articles welcome. Alternately some are using AcitveAdmin alongside React

Integrating rails with wordpress

I trying to integrate a current wordpress woocomerce website with a rails app.
I need to figure out with the best way to do two things:
Fetch, Create, update and delete products/posts with all the taxonomies and fields in the wordpress woocomerce website from my rails app.
Know when an order was did from paypal in the wordpress woocomerce website and then update my rails app.(already woocomerce know when the order was did and then update their wp tables)
I will appreciate if anyone could help me or show me the right way to do this :)
I was originally going to write about using an API for this, however, I think there's a better way - to hook into the WP table from Rails
From what you've written (which doesn't give much context btw), it seems you're looking for some way to manage your products & orders independently of Wordpress. Perhaps you want to integrate the data into a CRM, or you want to create an order-tracking system; it all needs data
Data
There are two ways to do it:
Create independent Rails app & port data with an API
Build the Rails app on top of the Wordpress db
API
An API will be best if you want to keep your data separate (you have sensitive data / you want to migrate to a total Rails solution)
You'll need to create your db through Rails, and then use a RESTful API interface to process JSON strings of all the products from WP. You'd have to send the objects by either a plugin, or a cron-job running a simple script to comb the database every night
As you can guess, this will be the least efficient way of doing it, but the most robust. You'd have two data-sets, and any updates in WP's table structure will have to be reflected in your Rails implementation
Wordpress
The better way to do this will be to hook into the Wordpress db directly
The problem here is that you'll effectively be managing two database systems (Rails likes to run off its own db), so you'll have to manage user profiles etc from the Rails DB, whilst hooking into the products db in Wordpress
Although I've got zero experience with this, I found some resources which may help:
Ruby on Rails Integration With Wordpress
Searching WordPress blog from Rails app
Hope this gives you some ideas!

How to use a Google API as my model?

I would like to use the Google Books API as the model for one of the controllers in my Rails app. Basically -I would still like this to act as a scaffold (though I won't be posting to / modifying it)
But I would still like to have a Book object, and be able to do a Book.find([google_book_id]).
What is the best way to go about setting something like this up? Should I generate a scaffold?
Since the Google Books API seems to be a typical REST service, I would start by looking at ActiveResource. It's a way of implementing ActiveRecord-ish models where the data is stored in an external service instead of your database. If you set up a Book model using ActiveResource, you would indeed be able to call Book.find(google_book_id) and have it return a Book object with the properties returned from the API.
Since I've never used ActiveResource myself I can't offer you much advice on the details, but it looks like you would need a way to either use OAuth or add an API key parameter to each request.

CRUD based authorization?

Does anyone know of a quick way to add a role CRUD system to rails?
I only want admins to create users and have all currently signed up users listed on a page in my app.
Im trying to figure out a way to assign users to different roles and restrict them for performing certain actions using collection select or a series of checkboxes.
Ive followed a few tutorials but none seem to be working for me :/
Can anyone recommend a solution? I us devise for my authorization it that matters.
You can think about CanCan. Using it you're able to define roles and restrict access to certain actions or model elements according to the role.
It can be also easily integrated with Devise mentioned by Scott Schulthess.
Devise on github has a wiki page showing how to do this
https://github.com/plataformatec/devise/wiki/How-To:-Add-an-Admin-role
You can also try using API Keys if you want to expose this API to many others

Resources