From 2fb18f246f3f8d00c98efda7066d83aeb814f8f7 Mon Sep 17 00:00:00 2001 From: Adam Altman Date: Fri, 11 Mar 2016 19:40:40 -0600 Subject: [PATCH 01/12] Change Vagrantfile setup... - homestead error; reverted to rasmus' php7dev box - configured nginx and mysql --- Comment.php | 20 ++++++++++--------- Vagrantfile | 45 +++++++++++++++++++++--------------------- layout.phtml | 4 ++-- masterclass.nginx.conf | 32 ++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 33 deletions(-) create mode 100644 masterclass.nginx.conf diff --git a/Comment.php b/Comment.php index bff2e3c..88e71c8 100644 --- a/Comment.php +++ b/Comment.php @@ -1,21 +1,24 @@ db = new PDO($dsn, $dbconfig['user'], $dbconfig['pass']); $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } - - public function create() { - if(!isset($_SESSION['AUTHENTICATED'])) { + + public function create() + { + if (!isset($_SESSION['AUTHENTICATED'])) { die('not auth'); header("Location: /"); exit; } - + $sql = 'INSERT INTO comment (created_by, created_on, story_id, comment) VALUES (?, NOW(), ?, ?)'; $stmt = $this->db->prepare($sql); $stmt->execute(array( @@ -25,5 +28,4 @@ public function create() { )); header("Location: /story/?id=" . $_POST['story_id']); } - -} \ No newline at end of file +} diff --git a/Vagrantfile b/Vagrantfile index 5c81259..6ad8074 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,28 +1,29 @@ -require 'json' -require 'yaml' +## first install vagrant hostmanager: +# `$ vagrant plugin install vagrant-hostmanager` -VAGRANTFILE_API_VERSION ||= "2" -confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) +$script = <