Laravel Consumer and Provider App architecture Laravel Consumer and Provider App architecture angularjs angularjs

Laravel Consumer and Provider App architecture


I would suggest you should use a given service like PubNub (see Demos).

That way you could save your Server-Development, there is also a Android-ExampleYou simple use it within your APP like this:

dependencies {    ....    compile 'com.pubnub:pubnub:3.7.4'    //'com.pubnub:pubnub-android-debug:3.7.+' For the debug version}

and

import com.pubnub.api.*;import org.json.*;Pubnub pubnub = new Pubnub("demo", "demo");try {  pubnub.subscribe("my_channel", new Callback() {      @Override      public void connectCallback(String channel, Object message) {          pubnub.publish("my_channel", "Hello from the PubNub Java SDK", new Callback() {});      }      @Override      public void disconnectCallback(String channel, Object message) {          System.out.println("SUBSCRIBE : DISCONNECT on channel:" + channel                     + " : " + message.getClass() + " : "                     + message.toString());      }      public void reconnectCallback(String channel, Object message) {          System.out.println("SUBSCRIBE : RECONNECT on channel:" + channel                     + " : " + message.getClass() + " : "                     + message.toString());      }      @Override      public void successCallback(String channel, Object message) {          System.out.println("SUBSCRIBE : " + channel + " : "                     + message.getClass() + " : " + message.toString());      }      @Override      public void errorCallback(String channel, PubnubError error) {          System.out.println("SUBSCRIBE : ERROR on channel " + channel                     + " : " + error.toString());      }    }  );} catch (PubnubException e) {  System.out.println(e.toString());}

If you are looking for ideas how Uber is doing this, look at the tutorial "The PubNub Connected Car Solution Kit"

So I hope I could answer, how Uber does this and how you can make it better :-)


I think a good solution would be putting all business logic into one Laravel application which is accessible via REST. So you don't have to update files twice.

The "real" apps only working as a middle tier and using this API.

For example in front you could setup Angular Apps. If you use nginx, you can define different locations per domain. This way all requests starting with "api" are routed to your Laravel application. The rest is routed to your static Angular App.

{    listen 80;    server_name customer.com;    location /api{        root /var/www/api;    }    location / {        root /var/www/static/customer;    }}{    listen 80;    server_name internalarea.com;    location /api{        root /var/www/api;    }    location / {        root /var/www/static/restricted;    }}

https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms

If you build your frontend apps also with Laravel, the API becomes a own URL which is used by the frontend systems. For doing this requests, I like using Zend\Http\Client which is very comfortable.


If you want to develop application for normar user and for provider.

Then I will suggest you to develop 2 seprate app and a single server (never create diffrent servers for any application)

Or you can assign user types at the time of registration.