Turns out this is how I get just the array from subtable:
$visits = $visits->subtable;
Thanks @ftrillo, typeof tells me its an Array and passing $visits to json_decode says
json_decode() expects parameter 1 to be string, array given
I am attempting to use Rob Brazier's Laravel-Piwik package to grab information from my Piwik install. I have this code to get visits to blog posts in the past week. It gives me an object, which contains an array, which is made up of objects.
$visits = Piwik::getActions(); $visits = $visits->getPageUrls(['period' => 'week', 'expanded' => '1', 'segment' => 'pageUrl%3D%5Ehttp%253A%252F%252Ftesting.dev%252Fblog%252F']); //$visits = $visits->subtable; dd($visits);
This works, it gets me the object and the dd shows it to me.
Here is the object it gives me: http://i.imgur.com/2o9TVpi.png
If I uncomment the commented out line there I get this error: Trying to get property "subtable" of non-object.
How do I access that array "subtable"? I would like to loop through it with a foreach.
Thanks @MikeHopley. On security I plan on doing all of the standard things: setup the firewall, fail2ban, and 20 other things.
Thanks for the sanity check there. I am going to go forward with this and see how it works out.
Thanks for that. Makes sense. And yes, it would be awesome to have more feedback from people who have been through this already.
gregghoush started a new conversation Sanity Check On My Deployment, Staging, Production Plan. Is It Good?
I am about to put my first Laravel project up. I am still early in development, but I am ready to have some testing, feedback, and all the other good stuff that comes from getting a staging server up. Here is my plan after watching the Envoyer videos, reading a bunch about Forge, and some other basic knowledge.
Use Forge to setup 2 servers on DigitalOcean. One for Production, one for Staging.
Setup HTTP basic auth blocking access to the staging server to unauthorized people. Thanks to Jacob Bennett for a simple solution: https://gistlog.co/JacobBennett/8193e13cef3427fbb88f
Create a "staging" branch for my git repository. Start working in this branch and only merging into master when I am ready for code to go to production.
Setup Envoyer with both servers. Set the production server to deploy automatically from the master branch of my projects github repo.
Setup Envoyer to deploy automatically from the staging branch to my staging server.
Modify the Envoyer deployment for staging by adding a hook to run migrate:fresh -- seed.
Setup different .env files for each server with the proper variables for staging or production.
This would seem to give me:
1 production server automatically deploying from my master branch whenever I push to github. This server would have production values in its .env and only migrate, but not seed when deplying.
1 staging server automatically deploying from my staging branch whenever I push that to github. This server would have staging values in its .env and it would wipe out the database, migrate it from scratch and re-seed it every time.
Am I missing anything here?
gregghoush started a new conversation Using A Global Vue Object And Adding More To The Data Array?
I currently am just defining a new Vue object on every page I do Vue work. I would prefer to define that in my app.js instead. Right now I do this on pages:
I could move that to app.js, but then how would I add in that password_options value to data on "app" from that specific page?
gregghoush started a new conversation Subscribe Notification On Signup, Remove On Subscription?
Starting a new Spark application today. One thing I noticed was that the notification asking people to subscribe is still there as a notification after they actually subscribe.
It feels like that should be replaced with a notification saying thanks for subscribing, once they actually subscribe? or at least removed.
Any thoughts on the best way to go about that?
Initial thought since notifications don't have types is to look for the user_id, icon=fa-clock-o, action_text=Subscribe and delete it. Anything wrong with that?
I will need this same thing coming up soon. Anyone have a solution to this?