Laravel Demo vs Live Application Site---> Access Models from One to Other - laravel

I have a live application for my app,(say at mysite.com). As part of my customer on boarding, I have a demo site at (demo.mysite.com), this is where I show potential customer what the app can do, etc. (Different databases and url). In order manage my system, i created also an admin panel on my live site.
Is it possible for me to control the demo site from my live site admin panel. I need to perform activities like,
After a user signs up on live site for a demo account, I create a demo customer via the admin panel after reviewing the request. Which means I need to access the demo site via controller to make a new "demo" customer model, is this possible? I know that I can make multiple mysql connections from live. But how can I perform Eloquent model operation from my live site?
Should I set up a different set up for my demo site.? Is this over complicated? I can set-up a demo accounts for my potential customers on my live site as well. I chose this set up thinking that it's safer in terms protecting data on my production site.

$demoUser = App\User::on('demo')->create([
//your attributes
]);
Here is an example how you can achieve an Eloquent operation on another connection. The on method returns a Illuminate\Database\Eloquent\Builder instance, btw you can go on and do whatever you want.

Related

Share sessions between laravel app and magento

I have an application of laravel that is on main domain i want to share session with subdomain.com which is on magento ! there would be a button on main website on laravel dashboard to go to store of magento and when user lands on it session should be created automatically like single sign on, how to achieve this?
There is many approach for example in micro service architecture there is special engine (app) to manage authentication, but for now
To keep your sessions going across multiple domains, you need to use
session_set_cookie_params(). With that, you can specify your domain. For example...
session_set_cookie_params(10000, "/", ".main.com");
That will set the session timeout at 10,000 seconds for all documents under the site root, and for all subdomains of main.com.
You should call session_set_cookie_params() before you do session_start().
Note: to achieve this functionality there is bunch of method but keep your own track and dive deep in all approach s

How to sync Firebase Database containing product data (Picture, Price) to show up on website Laravel?

We have a Firebase database connected with an APP which we want to convert to a website now. Laravel is nice frame work but unfortunately unable to sync the existing database to show up on the website as is. End goal is that any changes through an APP should reflect on the website and vice versa. Existing database include the product price, picture, ability for users to message each other , user authentication. In essence it is almost a complete market place.
If you want to use data from the Firebase Realtime Database in a web app/site, consider simply using its JavaScript SDK in your web application.
Doing so allows you app to directly read data from the database, instead of having to set up a web server in Laravel.
To ensure that your users only get access to data they're authorized for, you'll want to use Firebase's security rules. These are enforced on the Firebase server, so once you configure them correctly, there's no way for anyone to bypass them.

Multiple sites link to one back end, how to track which site traffic came from in laravel?

I have this web service that I'm trying to offer to multiple businesses of the same genre. They are all individual businesses not affiliated with each other but they can all use one database for submitting info. I basically want to put a link on each separate website that these businesses already have that will point a user to a generic login form that will dump their info into my database and track which company they came from. So if a user goes to Company A and clicks "sign up", i want it to take them to the sign up form but on the back end I'll know to put Company A's credentials with the user affiliation. Likewise if they went to Company B, i'd associate them with Company B. I don't know how to go about doing this in Laravel. Can i generate a custom URL for each company? if so, how do i do that so that i can track the company info? Side note: every company who uses this would also have a company profile with all their info already in my system. Could i create a database column for "company URL" and throw an if statement saying "if url==company A, do 'this'"? I just need a good direction to start in. thanks in advance.
You can add a header to the request going to Laravel says which company the request came from
Company model has many users and User model belongs to company change your routes of Login and Register Controllers to add company on your requests
https://laravel.com/docs/5.6/eloquent-relationships#one-to-many

Where to put logic for auto-login and creating members

Im new to Umbraco development, but im plenty familiar with ASP.Net & MVC etc. So Im getting to grips with the object model and terminology used, but Im not sure where to start. I need to use windows authentication on my Umbraco site, which will be for internal use only.
What I envision:
- When a domain user hits any area of the website, grab the user identity
- Lookup to see if matching user(or member) exists and if not create it
- Login this user to Umbraco
- By default all new visitors, if their user identity doesnt match a current member, then create that member and log them in.
Sounds like I need to create my own controller that overrides the base controller (RenderMvcController ?) and check the user identity on each and every request? Maybe do this by overriding the Index action method? Or could I do this with a macro - or as ive seen mentioned, are macros loosing favor with the new version of Umbraco?
Also, Im not sure how to deal with members vs users? As I understand it, members are who have access to the front part of the website, whereas users are those that have access to the back office area and can create/manage content.
Are all users also members?
There will be some that I want to give access to create/manage content, so when Im auto-creating users, its actually members that I need to create, not users?
[ update ]
Actually, I think I will need to create my own membership provider if I want every request routed through the check for a valid domain user? In my research, I keep coming across this example http://thegrayzone.co.uk/blog/2012/07/combined-authentication-with-umbraco/
I have overridden the default RenderMvcController in numerous projects with success, you could of course use the built in Umbraco auth to redirect to an authentication page for users that do not have a valid Umbraco Auth token and set it only only on that page based on their windows identity.
RE: Are users also members?
No. Users & Members are entirely independent of one another; users being back office users & members being front end users. You will need to create 2 accounts.

Composite C1 - Membership Provider - Simple Registration and Login

I am developing my first application using the Composite C1 CMS as the core system. I am currently working my way through the documentation and learning about data structuring, etc. I see that there is a paid Extranet package which can be purchased but I would prefer to develop my own Membership system within the site.
What would be the best way for me to allow users to register on the front end of my Composite C1 website and then to allow them access to a password protected area once they have registered and logged in?
I am a fairly experienced .net developer but Composite C1 is very new to me (at first impressions I like it a lot!)
Thanks
Like the commercial Extranet package you can write a RenderingResponseHandler plugin and register it it the ~/App_Data/Composite/Composite.config file.
Check the guide "How can I validate users before a page or media file is being served?"
RenderingResponseHandler plugins are tasked with approving page and media requests and they can either let the request pass or redirect the request to a new URL.
You would need to take care of the user data base and login page yourself. Also some mechanism that would allow a user of the cms to mark pages as protected/public might make sense.
There is relevant pointers on the CodePlex thread "Restricting access to MediaArchive files"

Resources