├── .gitignore ├── app ├── commands │ └── .gitkeep ├── config │ ├── app.php │ ├── auth.php │ ├── cache.php │ ├── compile.php │ ├── database.php │ ├── mail.php │ ├── packages │ │ └── .gitkeep │ ├── queue.php │ ├── session.php │ ├── testing │ │ ├── cache.php │ │ └── session.php │ ├── view.php │ └── workbench.php ├── controllers │ ├── AccountController.php │ ├── BaseController.php │ ├── CategoryController.php │ ├── IndexController.php │ ├── OrderController.php │ └── ProductController.php ├── database │ ├── migrations │ │ ├── 2013_12_03_000000_CreateAccountTable.php │ │ ├── 2013_12_03_000000_CreateCategoryTable.php │ │ ├── 2013_12_03_000000_CreateOrderItemTable.php │ │ ├── 2013_12_03_000000_CreateOrderTable.php │ │ └── 2013_12_03_000000_CreateProductTable.php │ └── seeds │ │ ├── AccountTableSeeder.php │ │ ├── CategoryTableSeeder.php │ │ ├── DatabaseSeeder.php │ │ ├── OrderItemTableSeeder.php │ │ ├── OrderTableSeeder.php │ │ └── ProductTableSeeder.php ├── filters.php ├── lang │ └── en │ │ ├── pagination.php │ │ ├── reminders.php │ │ └── validation.php ├── models │ ├── Account.php │ ├── Category.php │ ├── Order.php │ ├── OrderItem.php │ └── Product.php ├── routes.php ├── start │ ├── artisan.php │ ├── global.php │ └── local.php ├── storage │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── logs │ │ └── .gitignore │ ├── meta │ │ └── .gitignore │ ├── order-59.pdf │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── tests │ ├── ExampleTest.php │ └── TestCase.php └── views │ ├── email │ ├── invoice.blade.php │ └── wrapper.blade.php │ └── index.blade.php ├── artisan ├── bootstrap ├── autoload.php ├── paths.php └── start.php ├── code-of-conduct.md ├── composer.json ├── composer.lock ├── contributing.md ├── license.md ├── public ├── .htaccess ├── css │ ├── bootstrap.3.0.3.min.css │ ├── bootstrap.theme.3.0.3.min.css │ └── shared.css ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── index.php ├── js │ ├── angular-cookies.min.js.map │ ├── angular.min.js.map │ ├── angularjs.1.2.4.min.js │ ├── angularjs.cookies.1.2.4.min.js │ ├── bootstrap.3.0.3.min.js │ ├── jquery.1.10.2.min.js │ └── shared.js ├── packages │ └── .gitkeep └── robots.txt ├── vagrant_manifests └── default.pp ├── vagrant_modules ├── base │ └── manifests │ │ └── init.pp ├── memcache │ ├── manifests │ │ └── init.pp │ └── templates │ │ └── memcached.conf.erb ├── mysql │ ├── manifests │ │ ├── init.pp │ │ └── params.pp │ └── templates │ │ └── my.cnf.erb ├── nginx │ ├── manifests │ │ ├── init.pp │ │ └── params.pp │ └── templates │ │ ├── default.erb │ │ └── nginx.conf.erb └── php │ ├── manifests │ └── init.pp │ └── templates │ └── php.ini.erb ├── vagrantfile └── workbench └── formativ └── billing ├── .gitignore ├── .travis.yml ├── composer.json ├── phpunit.xml ├── src └── Formativ │ └── Billing │ ├── BillingServiceProvider.php │ ├── DocumentInterface.php │ ├── EmailMessenger.php │ ├── GatewayInterface.php │ ├── MessengerInterface.php │ ├── PDFDocument.php │ └── StripeGateway.php └── tests └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | vendor -------------------------------------------------------------------------------- /app/commands/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/app/commands/.gitkeep -------------------------------------------------------------------------------- /app/config/app.php: -------------------------------------------------------------------------------- 1 | true, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application URL 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This URL is used by the console to properly generate URLs when using 24 | | the Artisan command line tool. You should set this to the root of 25 | | your application so that it is used when running Artisan tasks. 26 | | 27 | */ 28 | 29 | 'url' => 'http://localhost', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Timezone 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may specify the default timezone for your application, which 37 | | will be used by the PHP date and date-time functions. We have gone 38 | | ahead and set this to a sensible default for you out of the box. 39 | | 40 | */ 41 | 42 | 'timezone' => 'UTC', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application Locale Configuration 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The application locale determines the default locale that will be used 50 | | by the translation service provider. You are free to set this value 51 | | to any of the locales which will be supported by the application. 52 | | 53 | */ 54 | 55 | 'locale' => 'en', 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Encryption Key 60 | |-------------------------------------------------------------------------- 61 | | 62 | | This key is used by the Illuminate encrypter service and should be set 63 | | to a random, 32 character string, otherwise these encrypted strings 64 | | will not be safe. Please do this before deploying an application! 65 | | 66 | */ 67 | 68 | 'key' => 'YourSecretKey!!!', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Autoloaded Service Providers 73 | |-------------------------------------------------------------------------- 74 | | 75 | | The service providers listed here will be automatically loaded on the 76 | | request to your application. Feel free to add your own services to 77 | | this array to grant expanded functionality to your applications. 78 | | 79 | */ 80 | 81 | 'providers' => array( 82 | 83 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 84 | 'Illuminate\Auth\AuthServiceProvider', 85 | 'Illuminate\Cache\CacheServiceProvider', 86 | 'Illuminate\Foundation\Providers\CommandCreatorServiceProvider', 87 | 'Illuminate\Session\CommandsServiceProvider', 88 | 'Illuminate\Foundation\Providers\ComposerServiceProvider', 89 | 'Illuminate\Routing\ControllerServiceProvider', 90 | 'Illuminate\Cookie\CookieServiceProvider', 91 | 'Illuminate\Database\DatabaseServiceProvider', 92 | 'Illuminate\Encryption\EncryptionServiceProvider', 93 | 'Illuminate\Filesystem\FilesystemServiceProvider', 94 | 'Illuminate\Hashing\HashServiceProvider', 95 | 'Illuminate\Html\HtmlServiceProvider', 96 | 'Illuminate\Foundation\Providers\KeyGeneratorServiceProvider', 97 | 'Illuminate\Log\LogServiceProvider', 98 | 'Illuminate\Mail\MailServiceProvider', 99 | 'Illuminate\Foundation\Providers\MaintenanceServiceProvider', 100 | 'Illuminate\Database\MigrationServiceProvider', 101 | 'Illuminate\Foundation\Providers\OptimizeServiceProvider', 102 | 'Illuminate\Pagination\PaginationServiceProvider', 103 | 'Illuminate\Foundation\Providers\PublisherServiceProvider', 104 | 'Illuminate\Queue\QueueServiceProvider', 105 | 'Illuminate\Redis\RedisServiceProvider', 106 | 'Illuminate\Auth\Reminders\ReminderServiceProvider', 107 | 'Illuminate\Foundation\Providers\RouteListServiceProvider', 108 | 'Illuminate\Database\SeedServiceProvider', 109 | 'Illuminate\Foundation\Providers\ServerServiceProvider', 110 | 'Illuminate\Session\SessionServiceProvider', 111 | 'Illuminate\Foundation\Providers\TinkerServiceProvider', 112 | 'Illuminate\Translation\TranslationServiceProvider', 113 | 'Illuminate\Validation\ValidationServiceProvider', 114 | 'Illuminate\View\ViewServiceProvider', 115 | 'Illuminate\Workbench\WorkbenchServiceProvider', 116 | 117 | "Formativ\Billing\BillingServiceProvider", 118 | 119 | ), 120 | 121 | /* 122 | |-------------------------------------------------------------------------- 123 | | Service Provider Manifest 124 | |-------------------------------------------------------------------------- 125 | | 126 | | The service provider manifest is used by Laravel to lazy load service 127 | | providers which are not needed for each request, as well to keep a 128 | | list of all of the services. Here, you may set its storage spot. 129 | | 130 | */ 131 | 132 | 'manifest' => storage_path().'/meta', 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Class Aliases 137 | |-------------------------------------------------------------------------- 138 | | 139 | | This array of class aliases will be registered when this application 140 | | is started. However, feel free to register as many as you wish as 141 | | the aliases are "lazy" loaded so they don't hinder performance. 142 | | 143 | */ 144 | 145 | 'aliases' => array( 146 | 147 | 'App' => 'Illuminate\Support\Facades\App', 148 | 'Artisan' => 'Illuminate\Support\Facades\Artisan', 149 | 'Auth' => 'Illuminate\Support\Facades\Auth', 150 | 'Blade' => 'Illuminate\Support\Facades\Blade', 151 | 'Cache' => 'Illuminate\Support\Facades\Cache', 152 | 'ClassLoader' => 'Illuminate\Support\ClassLoader', 153 | 'Config' => 'Illuminate\Support\Facades\Config', 154 | 'Controller' => 'Illuminate\Routing\Controllers\Controller', 155 | 'Cookie' => 'Illuminate\Support\Facades\Cookie', 156 | 'Crypt' => 'Illuminate\Support\Facades\Crypt', 157 | 'DB' => 'Illuminate\Support\Facades\DB', 158 | 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 159 | 'Event' => 'Illuminate\Support\Facades\Event', 160 | 'File' => 'Illuminate\Support\Facades\File', 161 | 'Form' => 'Illuminate\Support\Facades\Form', 162 | 'Hash' => 'Illuminate\Support\Facades\Hash', 163 | 'HTML' => 'Illuminate\Support\Facades\HTML', 164 | 'Input' => 'Illuminate\Support\Facades\Input', 165 | 'Lang' => 'Illuminate\Support\Facades\Lang', 166 | 'Log' => 'Illuminate\Support\Facades\Log', 167 | 'Mail' => 'Illuminate\Support\Facades\Mail', 168 | 'Paginator' => 'Illuminate\Support\Facades\Paginator', 169 | 'Password' => 'Illuminate\Support\Facades\Password', 170 | 'Queue' => 'Illuminate\Support\Facades\Queue', 171 | 'Redirect' => 'Illuminate\Support\Facades\Redirect', 172 | 'Redis' => 'Illuminate\Support\Facades\Redis', 173 | 'Request' => 'Illuminate\Support\Facades\Request', 174 | 'Response' => 'Illuminate\Support\Facades\Response', 175 | 'Route' => 'Illuminate\Support\Facades\Route', 176 | 'Schema' => 'Illuminate\Support\Facades\Schema', 177 | 'Seeder' => 'Illuminate\Database\Seeder', 178 | 'Session' => 'Illuminate\Support\Facades\Session', 179 | 'Str' => 'Illuminate\Support\Str', 180 | 'URL' => 'Illuminate\Support\Facades\URL', 181 | 'Validator' => 'Illuminate\Support\Facades\Validator', 182 | 'View' => 'Illuminate\Support\Facades\View', 183 | 184 | ), 185 | 186 | ); 187 | -------------------------------------------------------------------------------- /app/config/auth.php: -------------------------------------------------------------------------------- 1 | "eloquent", 5 | "model" => "Account", 6 | "table" => "account", 7 | "reminder" => [ 8 | "email" => "email/request", 9 | "table" => "token", 10 | "expire" => 60 11 | ] 12 | ]; -------------------------------------------------------------------------------- /app/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | File Cache Location 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "file" cache driver, we need a location where the cache 26 | | files may be stored. A sensible default has been specified, but you 27 | | are free to change it to any other place on disk that you desire. 28 | | 29 | */ 30 | 31 | 'path' => storage_path().'/cache', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Database Cache Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "database" cache driver you may specify the connection 39 | | that should be used to store the cached items. When this option is 40 | | null the default database connection will be utilized for cache. 41 | | 42 | */ 43 | 44 | 'connection' => null, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Database Cache Table 49 | |-------------------------------------------------------------------------- 50 | | 51 | | When using the "database" cache driver we need to know the table that 52 | | should be used to store the cached items. A default table name has 53 | | been provided but you're free to change it however you deem fit. 54 | | 55 | */ 56 | 57 | 'table' => 'cache', 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Memcached Servers 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Now you may specify an array of your Memcached servers that should be 65 | | used when utilizing the Memcached cache driver. All of the servers 66 | | should contain a value for "host", "port", and "weight" options. 67 | | 68 | */ 69 | 70 | 'memcached' => array( 71 | 72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 73 | 74 | ), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Cache Key Prefix 79 | |-------------------------------------------------------------------------- 80 | | 81 | | When utilizing a RAM based store such as APC or Memcached, there might 82 | | be other applications utilizing the same cache. So, we'll specify a 83 | | value to get prefixed to all our keys so we can avoid collisions. 84 | | 85 | */ 86 | 87 | 'prefix' => 'laravel', 88 | 89 | ); 90 | -------------------------------------------------------------------------------- /app/config/compile.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 5 | "default" => "mysql", 6 | "connections" => [ 7 | "mysql" => [ 8 | "driver" => "mysql", 9 | "host" => "localhost", 10 | "database" => "dev", 11 | "username" => "dev", 12 | "password" => "dev", 13 | "charset" => "utf8", 14 | "collation" => "utf8_unicode_ci", 15 | "prefix" => "" 16 | ] 17 | ], 18 | "migrations" => "migration" 19 | ]; -------------------------------------------------------------------------------- /app/config/mail.php: -------------------------------------------------------------------------------- 1 | 'smtp', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Postmark mail service, which will provide reliable delivery. 28 | | 29 | */ 30 | 31 | 'host' => 'smtp.mailgun.org', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to delivery e-mails to 39 | | users of your application. Like the host we have set this value to 40 | | stay compatible with the Postmark e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => 587, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => array('address' => null, 'name' => null), 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => 'tls', 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => '', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => '', 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Mail "Pretend" 114 | |-------------------------------------------------------------------------- 115 | | 116 | | When this option is enabled, e-mail will not actually be sent over the 117 | | web and will instead be written to your application's logs files so 118 | | you may inspect the message. This is great for local development. 119 | | 120 | */ 121 | 122 | 'pretend' => false, 123 | 124 | ); -------------------------------------------------------------------------------- /app/config/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/app/config/packages/.gitkeep -------------------------------------------------------------------------------- /app/config/queue.php: -------------------------------------------------------------------------------- 1 | 'sync', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => array( 32 | 33 | 'sync' => array( 34 | 'driver' => 'sync', 35 | ), 36 | 37 | 'beanstalkd' => array( 38 | 'driver' => 'beanstalkd', 39 | 'host' => 'localhost', 40 | 'queue' => 'default', 41 | ), 42 | 43 | 'sqs' => array( 44 | 'driver' => 'sqs', 45 | 'key' => 'your-public-key', 46 | 'secret' => 'your-secret-key', 47 | 'queue' => 'your-queue-url', 48 | 'region' => 'us-east-1', 49 | ), 50 | 51 | 'iron' => array( 52 | 'driver' => 'iron', 53 | 'project' => 'your-project-id', 54 | 'token' => 'your-token', 55 | 'queue' => 'your-queue-name', 56 | ), 57 | 58 | ), 59 | 60 | ); 61 | -------------------------------------------------------------------------------- /app/config/session.php: -------------------------------------------------------------------------------- 1 | 'native', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire when the browser closes, set it to zero. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Session File Location 37 | |-------------------------------------------------------------------------- 38 | | 39 | | When using the native session driver, we need a location where session 40 | | files may be stored. A default has been set for you but a different 41 | | location may be specified. This is only needed for file sessions. 42 | | 43 | */ 44 | 45 | 'files' => storage_path().'/sessions', 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Session Database Connection 50 | |-------------------------------------------------------------------------- 51 | | 52 | | When using the "database" session driver, you may specify the database 53 | | connection that should be used to manage your sessions. This should 54 | | correspond to a connection in your "database" configuration file. 55 | | 56 | */ 57 | 58 | 'connection' => null, 59 | 60 | /* 61 | |-------------------------------------------------------------------------- 62 | | Session Database Table 63 | |-------------------------------------------------------------------------- 64 | | 65 | | When using the "database" session driver, you may specify the table we 66 | | should use to manage the sessions. Of course, a sensible default is 67 | | provided for you; however, you are free to change this as needed. 68 | | 69 | */ 70 | 71 | 'table' => 'sessions', 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Session Sweeping Lottery 76 | |-------------------------------------------------------------------------- 77 | | 78 | | Some session drivers must manually sweep their storage location to get 79 | | rid of old sessions from storage. Here are the chances that it will 80 | | happen on a given request. By default, the odds are 2 out of 100. 81 | | 82 | */ 83 | 84 | 'lottery' => array(2, 100), 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | Session Cookie Name 89 | |-------------------------------------------------------------------------- 90 | | 91 | | Here you may change the name of the cookie used to identify a session 92 | | instance by ID. The name specified here will get used every time a 93 | | new session cookie is created by the framework for every driver. 94 | | 95 | */ 96 | 97 | 'cookie' => 'laravel_session', 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Session Cookie Path 102 | |-------------------------------------------------------------------------- 103 | | 104 | | The session cookie path determines the path for which the cookie will 105 | | be regarded as available. Typically, this will be the root path of 106 | | your application but you are free to change this when necessary. 107 | | 108 | */ 109 | 110 | 'path' => '/', 111 | 112 | /* 113 | |-------------------------------------------------------------------------- 114 | | Session Cookie Domain 115 | |-------------------------------------------------------------------------- 116 | | 117 | | Here you may change the domain of the cookie used to identify a session 118 | | in your application. This will determine which domains the cookie is 119 | | available to in your application. A sensible default has been set. 120 | | 121 | */ 122 | 123 | 'domain' => null, 124 | 125 | ); 126 | -------------------------------------------------------------------------------- /app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); -------------------------------------------------------------------------------- /app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); -------------------------------------------------------------------------------- /app/config/view.php: -------------------------------------------------------------------------------- 1 | array(__DIR__.'/../views'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Pagination View 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This view will be used to render the pagination link output, and can 24 | | be easily customized here to show any view you like. A clean view 25 | | compatible with Twitter's Bootstrap is given to you by default. 26 | | 27 | */ 28 | 29 | 'pagination' => 'pagination::slider', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/workbench.php: -------------------------------------------------------------------------------- 1 | '', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Workbench Author E-Mail Address 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Like the option above, your e-mail address is used when generating new 24 | | workbench packages. The e-mail is placed in your composer.json file 25 | | automatically after the package is created by the workbench tool. 26 | | 27 | */ 28 | 29 | 'email' => '', 30 | 31 | ); -------------------------------------------------------------------------------- /app/controllers/AccountController.php: -------------------------------------------------------------------------------- 1 | Input::get("email"), 10 | "password" => Input::get("password") 11 | ]; 12 | 13 | if (Auth::attempt($credentials)) 14 | { 15 | return Response::json([ 16 | "status" => "ok", 17 | "account" => Auth::user()->toArray() 18 | ]); 19 | } 20 | 21 | return Response::json([ 22 | "status" => "error" 23 | ]); 24 | } 25 | } -------------------------------------------------------------------------------- /app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /app/controllers/CategoryController.php: -------------------------------------------------------------------------------- 1 | get(); 9 | } 10 | } -------------------------------------------------------------------------------- /app/controllers/IndexController.php: -------------------------------------------------------------------------------- 1 | gateway = $gateway; 21 | $this->document = $document; 22 | $this->messenger = $messenger; 23 | } 24 | 25 | public function indexAction() 26 | { 27 | $query = Order::with([ 28 | "account", 29 | "orderItems", 30 | "orderItems.product", 31 | "orderItems.product.category" 32 | ]); 33 | 34 | $account = Input::get("account"); 35 | 36 | if ($account) 37 | { 38 | $query->where("account_id", $account); 39 | } 40 | 41 | return $query->get(); 42 | } 43 | 44 | public function addAction() 45 | { 46 | $validator = Validator::make(Input::all(), [ 47 | "account" => "required|exists:account,id", 48 | "items" => "required" 49 | ]); 50 | 51 | if ($validator->passes()) 52 | { 53 | $order = Order::create([ 54 | "account_id" => Input::get("account") 55 | ]); 56 | 57 | try 58 | { 59 | $items = json_decode(Input::get("items")); 60 | } 61 | catch (Exception $e) 62 | { 63 | return Response::json([ 64 | "status" => "error", 65 | "errors" => [ 66 | "items" => [ 67 | "Invalid items format." 68 | ] 69 | ] 70 | ]); 71 | } 72 | 73 | $total = 0; 74 | 75 | foreach ($items as $item) 76 | { 77 | $orderItem = OrderItem::create([ 78 | "order_id" => $order->id, 79 | "product_id" => $item->product_id, 80 | "quantity" => $item->quantity 81 | ]); 82 | 83 | $product = $orderItem->product; 84 | 85 | $orderItem->price = $product->price; 86 | $orderItem->save(); 87 | 88 | $product->stock -= $item->quantity; 89 | $product->save(); 90 | 91 | $total += $orderItem->quantity * $orderItem->price; 92 | } 93 | 94 | $result = $this->gateway->pay( 95 | Input::get("number"), 96 | Input::get("expiry"), 97 | $total, 98 | "usd" 99 | ); 100 | 101 | if (!$result) 102 | { 103 | return Response::json([ 104 | "status" => "error", 105 | "errors" => [ 106 | "gateway" => [ 107 | "Payment error" 108 | ] 109 | ] 110 | ]); 111 | } 112 | 113 | $account = $order->account; 114 | 115 | $document = $this->document->create($order); 116 | $this->messenger->send($order, $document); 117 | 118 | return Response::json([ 119 | "status" => "ok", 120 | "order" => $order->toArray() 121 | ]); 122 | } 123 | 124 | return Response::json([ 125 | "status" => "error", 126 | "errors" => $validator->errors()->toArray() 127 | ]); 128 | } 129 | } -------------------------------------------------------------------------------- /app/controllers/ProductController.php: -------------------------------------------------------------------------------- 1 | where("category_id", $category); 14 | } 15 | 16 | return $query->get(); 17 | } 18 | } -------------------------------------------------------------------------------- /app/database/migrations/2013_12_03_000000_CreateAccountTable.php: -------------------------------------------------------------------------------- 1 | engine = "InnoDB"; 13 | 14 | $table->increments("id"); 15 | $table->string("email"); 16 | $table->string("password"); 17 | $table->dateTime("created_at"); 18 | $table->dateTime("updated_at"); 19 | $table->dateTime("deleted_at"); 20 | }); 21 | } 22 | 23 | public function down() 24 | { 25 | Schema::dropIfExists("account"); 26 | } 27 | } -------------------------------------------------------------------------------- /app/database/migrations/2013_12_03_000000_CreateCategoryTable.php: -------------------------------------------------------------------------------- 1 | engine = "InnoDB"; 13 | 14 | $table->increments("id"); 15 | $table->string("name"); 16 | $table->dateTime("created_at"); 17 | $table->dateTime("updated_at"); 18 | $table->dateTime("deleted_at"); 19 | }); 20 | } 21 | 22 | public function down() 23 | { 24 | Schema::dropIfExists("category"); 25 | } 26 | } -------------------------------------------------------------------------------- /app/database/migrations/2013_12_03_000000_CreateOrderItemTable.php: -------------------------------------------------------------------------------- 1 | engine = "InnoDB"; 13 | 14 | $table->increments("id"); 15 | $table->integer("order_id"); 16 | $table->integer("product_id"); 17 | $table->integer("quantity"); 18 | $table->float("price"); 19 | $table->dateTime("created_at"); 20 | $table->dateTime("updated_at"); 21 | $table->dateTime("deleted_at"); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::dropIfExists("order_item"); 28 | } 29 | } -------------------------------------------------------------------------------- /app/database/migrations/2013_12_03_000000_CreateOrderTable.php: -------------------------------------------------------------------------------- 1 | engine = "InnoDB"; 13 | 14 | $table->increments("id"); 15 | $table->integer("account_id"); 16 | $table->dateTime("created_at"); 17 | $table->dateTime("updated_at"); 18 | $table->dateTime("deleted_at"); 19 | }); 20 | } 21 | 22 | public function down() 23 | { 24 | Schema::dropIfExists("order"); 25 | } 26 | } -------------------------------------------------------------------------------- /app/database/migrations/2013_12_03_000000_CreateProductTable.php: -------------------------------------------------------------------------------- 1 | engine = "InnoDB"; 13 | 14 | $table->increments("id"); 15 | $table->string("name"); 16 | $table->integer("stock"); 17 | $table->float("price"); 18 | $table->integer("category_id"); 19 | $table->dateTime("created_at"); 20 | $table->dateTime("updated_at"); 21 | $table->dateTime("deleted_at"); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::dropIfExists("product"); 28 | } 29 | } -------------------------------------------------------------------------------- /app/database/seeds/AccountTableSeeder.php: -------------------------------------------------------------------------------- 1 | getFaker(); 9 | 10 | for ($i = 0; $i < 10; $i++) 11 | { 12 | $email = $faker->email; 13 | $password = Hash::make("password"); 14 | 15 | Account::create([ 16 | "email" => $email, 17 | "password" => $password 18 | ]); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /app/database/seeds/CategoryTableSeeder.php: -------------------------------------------------------------------------------- 1 | getFaker(); 9 | 10 | for ($i = 0; $i < 10; $i++) 11 | { 12 | $name = ucwords($faker->word); 13 | 14 | Category::create([ 15 | "name" => $name 16 | ]); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | faker)) 11 | { 12 | $faker = Faker\Factory::create(); 13 | $faker->addProvider(new Faker\Provider\Base($faker)); 14 | $faker->addProvider(new Faker\Provider\Lorem($faker)); 15 | } 16 | 17 | return $this->faker = $faker; 18 | } 19 | 20 | public function run() 21 | { 22 | $this->call("AccountTableSeeder"); 23 | $this->call("CategoryTableSeeder"); 24 | $this->call("ProductTableSeeder"); 25 | $this->call("OrderTableSeeder"); 26 | $this->call("OrderItemTableSeeder"); 27 | } 28 | } -------------------------------------------------------------------------------- /app/database/seeds/OrderItemTableSeeder.php: -------------------------------------------------------------------------------- 1 | getFaker(); 9 | 10 | $orders = Order::all(); 11 | $products = Product::all()->toArray(); 12 | 13 | foreach ($orders as $order) 14 | { 15 | $used = []; 16 | 17 | for ($i = 0; $i < rand(1, 5); $i++) 18 | { 19 | $product = $faker->randomElement($products); 20 | 21 | if (!in_array($product["id"], $used)) 22 | { 23 | $id = $product["id"]; 24 | $price = $product["price"]; 25 | $quantity = $faker->randomNumber(1, 3); 26 | 27 | OrderItem::create([ 28 | "order_id" => $order->id, 29 | "product_id" => $id, 30 | "price" => $price, 31 | "quantity" => $quantity 32 | ]); 33 | 34 | $used[] = $product["id"]; 35 | } 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /app/database/seeds/OrderTableSeeder.php: -------------------------------------------------------------------------------- 1 | getFaker(); 9 | 10 | $accounts = Account::all(); 11 | 12 | foreach ($accounts as $account) 13 | { 14 | for ($i = 0; $i < rand(-1, 5); $i++) 15 | { 16 | Order::create([ 17 | "account_id" => $account->id 18 | ]); 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /app/database/seeds/ProductTableSeeder.php: -------------------------------------------------------------------------------- 1 | getFaker(); 9 | 10 | $categories = Category::all(); 11 | 12 | foreach ($categories as $category) 13 | { 14 | for ($i = 0; $i < rand(-1, 10); $i++) 15 | { 16 | $name = ucwords($faker->word); 17 | $stock = $faker->randomNumber(0, 100); 18 | $price = $faker->randomFloat(2, 5, 100); 19 | 20 | Product::create([ 21 | "name" => $name, 22 | "stock" => $stock, 23 | "price" => $price, 24 | "category_id" => $category->id 25 | ]); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /app/filters.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); -------------------------------------------------------------------------------- /app/lang/en/reminders.php: -------------------------------------------------------------------------------- 1 | "Passwords must be six characters and match the confirmation.", 17 | 18 | "user" => "We can't find a user with that e-mail address.", 19 | 20 | "token" => "This password reset token is invalid.", 21 | 22 | ); -------------------------------------------------------------------------------- /app/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | "The :attribute must be accepted.", 17 | "active_url" => "The :attribute is not a valid URL.", 18 | "after" => "The :attribute must be a date after :date.", 19 | "alpha" => "The :attribute may only contain letters.", 20 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", 21 | "alpha_num" => "The :attribute may only contain letters and numbers.", 22 | "array" => "The :attribute must be an array.", 23 | "before" => "The :attribute must be a date before :date.", 24 | "between" => array( 25 | "numeric" => "The :attribute must be between :min - :max.", 26 | "file" => "The :attribute must be between :min - :max kilobytes.", 27 | "string" => "The :attribute must be between :min - :max characters.", 28 | "array" => "The :attribute must have between :min - :max items.", 29 | ), 30 | "confirmed" => "The :attribute confirmation does not match.", 31 | "date" => "The :attribute is not a valid date.", 32 | "date_format" => "The :attribute does not match the format :format.", 33 | "different" => "The :attribute and :other must be different.", 34 | "digits" => "The :attribute must be :digits digits.", 35 | "digits_between" => "The :attribute must be between :min and :max digits.", 36 | "email" => "The :attribute format is invalid.", 37 | "exists" => "The selected :attribute is invalid.", 38 | "image" => "The :attribute must be an image.", 39 | "in" => "The selected :attribute is invalid.", 40 | "integer" => "The :attribute must be an integer.", 41 | "ip" => "The :attribute must be a valid IP address.", 42 | "max" => array( 43 | "numeric" => "The :attribute may not be greater than :max.", 44 | "file" => "The :attribute may not be greater than :max kilobytes.", 45 | "string" => "The :attribute may not be greater than :max characters.", 46 | "array" => "The :attribute may not have more than :max items.", 47 | ), 48 | "mimes" => "The :attribute must be a file of type: :values.", 49 | "min" => array( 50 | "numeric" => "The :attribute must be at least :min.", 51 | "file" => "The :attribute must be at least :min kilobytes.", 52 | "string" => "The :attribute must be at least :min characters.", 53 | "array" => "The :attribute must have at least :min items.", 54 | ), 55 | "not_in" => "The selected :attribute is invalid.", 56 | "numeric" => "The :attribute must be a number.", 57 | "regex" => "The :attribute format is invalid.", 58 | "required" => "The :attribute field is required.", 59 | "required_if" => "The :attribute field is required when :other is :value.", 60 | "required_with" => "The :attribute field is required when :values is present.", 61 | "required_without" => "The :attribute field is required when :values is not present.", 62 | "same" => "The :attribute and :other must match.", 63 | "size" => array( 64 | "numeric" => "The :attribute must be :size.", 65 | "file" => "The :attribute must be :size kilobytes.", 66 | "string" => "The :attribute must be :size characters.", 67 | "array" => "The :attribute must contain :size items.", 68 | ), 69 | "unique" => "The :attribute has already been taken.", 70 | "url" => "The :attribute format is invalid.", 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | Custom Validation Language Lines 75 | |-------------------------------------------------------------------------- 76 | | 77 | | Here you may specify custom validation messages for attributes using the 78 | | convention "attribute.rule" to name the lines. This makes it quick to 79 | | specify a specific custom language line for a given attribute rule. 80 | | 81 | */ 82 | 83 | 'custom' => array(), 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Custom Validation Attributes 88 | |-------------------------------------------------------------------------- 89 | | 90 | | The following language lines are used to swap attribute place-holders 91 | | with something more reader friendly such as E-Mail Address instead 92 | | of "email". This simply helps us make messages a little cleaner. 93 | | 94 | */ 95 | 96 | 'attributes' => array(), 97 | 98 | ); 99 | -------------------------------------------------------------------------------- /app/models/Account.php: -------------------------------------------------------------------------------- 1 | getKey(); 21 | } 22 | 23 | public function getAuthPassword() 24 | { 25 | return $this->password; 26 | } 27 | 28 | public function getReminderEmail() 29 | { 30 | return $this->email; 31 | } 32 | 33 | public function orders() 34 | { 35 | return $this->hasMany("Order"); 36 | } 37 | } -------------------------------------------------------------------------------- /app/models/Category.php: -------------------------------------------------------------------------------- 1 | hasMany("Product"); 15 | } 16 | } -------------------------------------------------------------------------------- /app/models/Order.php: -------------------------------------------------------------------------------- 1 | belongsTo("Account"); 15 | } 16 | 17 | public function orderItems() 18 | { 19 | return $this->hasMany("OrderItem"); 20 | } 21 | 22 | public function products() 23 | { 24 | return $this->belongsToMany("Product", "order_item"); 25 | } 26 | 27 | public function getTotalAttribute() 28 | { 29 | $total = 0; 30 | 31 | foreach ($this->orderItems as $orderItem) 32 | { 33 | $total += $orderItem->price * $orderItem->quantity; 34 | } 35 | 36 | return $total; 37 | } 38 | } -------------------------------------------------------------------------------- /app/models/OrderItem.php: -------------------------------------------------------------------------------- 1 | belongsTo("Product"); 15 | } 16 | 17 | public function order() 18 | { 19 | return $this->belongsTo("Order"); 20 | } 21 | 22 | public function getTotalAttribute() 23 | { 24 | return $this->quantity * $this->price; 25 | } 26 | } -------------------------------------------------------------------------------- /app/models/Product.php: -------------------------------------------------------------------------------- 1 | belongsToMany("Order", "order_item"); 15 | } 16 | 17 | public function orderItems() 18 | { 19 | return $this->hasMany("OrderItem"); 20 | } 21 | 22 | public function category() 23 | { 24 | return $this->belongsTo("Category"); 25 | } 26 | } -------------------------------------------------------------------------------- /app/routes.php: -------------------------------------------------------------------------------- 1 | "index/index", 9 | "uses" => "IndexController@indexAction" 10 | ]); 11 | 12 | Route::any("category/index", [ 13 | "as" => "category/index", 14 | "uses" => "CategoryController@indexAction" 15 | ]); 16 | 17 | Route::any("product/index", [ 18 | "as" => "product/index", 19 | "uses" => "ProductController@indexAction" 20 | ]); 21 | 22 | Route::any("account/authenticate", [ 23 | "as" => "account/authenticate", 24 | "uses" => "AccountController@authenticateAction" 25 | ]); 26 | 27 | Route::any("order/index", [ 28 | "as" => "order/index", 29 | "uses" => "OrderController@indexAction" 30 | ]); 31 | 32 | Route::any("order/add", [ 33 | "as" => "order/add", 34 | "uses" => "OrderController@addAction" 35 | ]); 36 | 37 | Route::any("order/delete", [ 38 | "as" => "order/delete", 39 | "uses" => "OrderController@deleteAction" 40 | ]); -------------------------------------------------------------------------------- /app/start/artisan.php: -------------------------------------------------------------------------------- 1 | client->request('GET', '/'); 13 | 14 | $this->assertTrue($this->client->getResponse()->isOk()); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Laravel 4 E-Commerce 6 | 22 | 23 | 24 |
25 |
26 |
27 | 28 |
29 |
30 | 31 | 32 | 35 | 38 | 39 | 40 | 43 | 46 | 47 |
33 | Account 34 | 36 | {{ $order->account->email }} 37 |
41 | Date 42 | 44 | {{ $order->created_at->format("F jS, Y"); }} 45 |
48 |
49 |
50 |
51 |
52 |

Invoice {{ $order->id }}

53 |
54 |
55 |
56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | @foreach ($order->orderItems as $orderItem) 67 | 68 | 71 | 74 | 77 | 78 | @endforeach 79 | 80 | 81 | 84 | 87 | 88 | 89 |
ProductQuantityAmount
69 | {{ $orderItem->product->name }} 70 | 72 | {{ $orderItem->quantity }} 73 | 75 | $ {{ number_format($orderItem->total, 2) }} 76 |
  82 | Total 83 | 85 | $ {{ number_format($order->total, 2) }} 86 |
90 |
91 |
92 |
93 | 94 | -------------------------------------------------------------------------------- /app/views/email/wrapper.blade.php: -------------------------------------------------------------------------------- 1 | Here's your invoice! -------------------------------------------------------------------------------- /app/views/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Laravel 4 E-Commerce 6 | 11 | 16 | 21 | 25 | 29 | 30 | 31 |
32 |
33 |
34 |

35 | Laravel 4 E-Commerce 36 |

37 |
38 |
39 |
40 |
41 |

42 | Products 43 |

44 |
45 | 53 | 62 |
63 |
64 |
68 | 75 |
76 |

@{{ product.name }}

77 |

78 | Price: @{{ product.price }}, Stock: @{{ product.stock }} 79 |

80 |
81 |
82 |
83 |
84 |
85 |

86 | Basket 87 |

88 |
89 | 90 | 95 | 98 | 107 | 110 | 116 | 117 | 118 | 129 | 130 | 131 | 142 | 143 | 144 | 156 | 157 | 158 | 169 | 170 | 171 | 182 | 183 | 184 | 195 | 196 | 197 | 209 | 210 |
96 | @{{ product.name }} 97 | 99 | 106 | 108 | @{{ product.total }} 109 | 111 | 115 |
122 | 128 |
135 | 141 |
148 | 155 |
162 | 168 |
175 | 181 |
188 | 194 |
201 | 208 |
211 |
212 |
213 |
214 |
215 | 219 | 220 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | boot(); 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Load The Artisan Console Application 37 | |-------------------------------------------------------------------------- 38 | | 39 | | We'll need to run the script to load and return the Artisan console 40 | | application. We keep this in its own script so that we will load 41 | | the console application independent of running commands which 42 | | will allow us to fire commands from Routes when we want to. 43 | | 44 | */ 45 | 46 | $artisan = Illuminate\Console\Application::start($app); 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Run The Artisan Application 51 | |-------------------------------------------------------------------------- 52 | | 53 | | When we run the console application, the current CLI command will be 54 | | executed in this console and the response sent back to a terminal 55 | | or another output device for the developers. Here goes nothing! 56 | | 57 | */ 58 | 59 | $status = $artisan->run(); 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Shutdown The Application 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Once Artisan has finished running. We will fire off the shutdown events 67 | | so that any final work may be done by the application before we shut 68 | | down the process. This is the last thing to happen to the request. 69 | | 70 | */ 71 | 72 | $app->shutdown(); 73 | 74 | exit($status); -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | __DIR__.'/../app', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Public Path 21 | |-------------------------------------------------------------------------- 22 | | 23 | | The public path contains the assets for your web application, such as 24 | | your JavaScript and CSS files, and also contains the primary entry 25 | | point for web requests into these applications from the outside. 26 | | 27 | */ 28 | 29 | 'public' => __DIR__.'/../public', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Base Path 34 | |-------------------------------------------------------------------------- 35 | | 36 | | The base path is the root of the Laravel installation. Most likely you 37 | | will not need to change this value. But, if for some wild reason it 38 | | is necessary you will do so here, just proceed with some caution. 39 | | 40 | */ 41 | 42 | 'base' => __DIR__.'/..', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Storage Path 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The storage path is used by Laravel to store cached Blade views, logs 50 | | and other pieces of information. You may modify the path here when 51 | | you want to change the location of this directory for your apps. 52 | | 53 | */ 54 | 55 | 'storage' => __DIR__.'/../app/storage', 56 | 57 | ); 58 | -------------------------------------------------------------------------------- /bootstrap/start.php: -------------------------------------------------------------------------------- 1 | redirectIfTrailingSlash(); 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Detect The Application Environment 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Laravel takes a dead simple approach to your application environments 24 | | so you can just specify a machine name or HTTP host that matches a 25 | | given environment, then we will automatically detect it for you. 26 | | 27 | */ 28 | 29 | $env = $app->detectEnvironment(array( 30 | 31 | 'local' => array('your-machine-name'), 32 | 33 | )); 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Bind Paths 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here we are binding the paths configured in paths.php to the app. You 41 | | should not be changing these here. If you need to change these you 42 | | may do so within the paths.php file and they will be bound here. 43 | | 44 | */ 45 | 46 | $app->bindInstallPaths(require __DIR__.'/paths.php'); 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Load The Application 51 | |-------------------------------------------------------------------------- 52 | | 53 | | Here we will load the Illuminate application. We'll keep this is in a 54 | | separate location so we can isolate the creation of an application 55 | | from the actual running of the application with a given request. 56 | | 57 | */ 58 | 59 | $framework = $app['path.base'].'/vendor/laravel/framework/src'; 60 | 61 | require $framework.'/Illuminate/Foundation/start.php'; 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | Return The Application 66 | |-------------------------------------------------------------------------- 67 | | 68 | | This script returns the application instance. The instance is given to 69 | | the calling script so we can separate the building of the instances 70 | | from the actual running of the application and sending responses. 71 | | 72 | */ 73 | 74 | return $app; 75 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. 6 | 7 | Examples of unacceptable behavior by participants include: 8 | 9 | * The use of sexualized language or imagery 10 | * Personal attacks 11 | * Trolling or insulting/derogatory comments 12 | * Public or private harassment 13 | * Publishing other's private information, such as physical or electronic addresses, without explicit permission 14 | * Other unethical or unprofessional conduct. 15 | 16 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. 17 | 18 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 21 | 22 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "laravel/laravel", 3 | "description" : "The Laravel Framework.", 4 | "keywords" : ["framework", "laravel"], 5 | "license" : "MIT", 6 | "require" : { 7 | "laravel/framework" : "4.0.*", 8 | "dompdf/dompdf" : "dev-master", 9 | "fzaninotto/faker" : "dev-master", 10 | "stripe/stripe-php" : "dev-master" 11 | }, 12 | "autoload" : { 13 | "classmap" : [ 14 | "app/commands", 15 | "app/controllers", 16 | "app/models", 17 | "app/database/migrations", 18 | "app/database/seeds", 19 | "app/tests/TestCase.php" 20 | ], 21 | "psr-0": { 22 | "Formativ\\Billing": "workbench/formativ/billing/src/" 23 | } 24 | }, 25 | "scripts" : { 26 | "post-install-cmd" : [ 27 | "php artisan optimize" 28 | ], 29 | "post-update-cmd" : [ 30 | "php artisan clear-compiled", 31 | "php artisan optimize" 32 | ], 33 | "post-create-project-cmd" : [ 34 | "php artisan key:generate" 35 | ] 36 | }, 37 | "config" : { 38 | "preferred-install" : "dist" 39 | }, 40 | "minimum-stability" : "dev" 41 | } -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are welcome! Create an issue, explaining a bug or proposal. Submit pull requests if you feel brave. Speak to me on [Twitter](https://twitter.com/assertchris). 4 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) 2015 Christopher Pitt 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Options -MultiViews 3 | RewriteEngine On 4 | 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | RewriteRule ^ index.php [L] 8 | -------------------------------------------------------------------------------- /public/css/bootstrap.theme.3.0.3.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | .btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);background-repeat:repeat-x;border-color:#2b669a;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff2d6ca2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);background-repeat:repeat-x;border-color:#3e8f3e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff419641',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);background-repeat:repeat-x;border-color:#e38d13;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffeb9316',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);background-repeat:repeat-x;border-color:#b92c28;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc12e2a',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);background-repeat:repeat-x;border-color:#28a4c9;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2aabd2',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#357ebd;background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);background-repeat:repeat-x;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff8f8f8',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 5px rgba(0,0,0,0.075)}.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff3f3f3',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.075);box-shadow:inset 0 3px 9px rgba(0,0,0,0.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,0.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:linear-gradient(to bottom,#222 0,#282828 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff282828',GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,0.25);box-shadow:inset 0 3px 9px rgba(0,0,0,0.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.25),0 1px 2px rgba(0,0,0,0.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);background-repeat:repeat-x;border-color:#b2dba1;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffc8e5bc',GradientType=0)}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);background-repeat:repeat-x;border-color:#9acfea;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffb9def0',GradientType=0)}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);background-repeat:repeat-x;border-color:#f5e79e;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fff8efc0',GradientType=0)}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);background-repeat:repeat-x;border-color:#dca7a7;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffe7c3c3',GradientType=0)}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb',endColorstr='#fff5f5f5',GradientType=0)}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3071a9',GradientType=0)}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c',endColorstr='#ff449d44',GradientType=0)}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff31b0d5',GradientType=0)}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e',endColorstr='#ffec971f',GradientType=0)}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f',endColorstr='#ffc9302c',GradientType=0)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.075);box-shadow:0 1px 2px rgba(0,0,0,0.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);background-repeat:repeat-x;border-color:#3278b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff3278b3',GradientType=0)}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#ffe8e8e8',GradientType=0)}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca',endColorstr='#ff357ebd',GradientType=0)}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8',endColorstr='#ffd0e9c6',GradientType=0)}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7',endColorstr='#ffc4e3f3',GradientType=0)}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3',endColorstr='#fffaf2cc',GradientType=0)}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede',endColorstr='#ffebcccc',GradientType=0)}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);background-repeat:repeat-x;border-color:#dcdcdc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 3px rgba(0,0,0,0.05),0 1px 0 rgba(255,255,255,0.1)} -------------------------------------------------------------------------------- /public/css/shared.css: -------------------------------------------------------------------------------- 1 | .products { 2 | margin-top: 20px; 3 | } 4 | .basket td { 5 | vertical-align: middle !important; 6 | } 7 | .basket .quantity input { 8 | width: 50px; 9 | } -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/public/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/public/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/public/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader 15 | | for our application. We just need to utilize it! We'll require it 16 | | into the script here so that we do not have to worry about the 17 | | loading of any our classes "manually". Feels great to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let's turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight these users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/start.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can simply call the run method, 43 | | which will execute the request and send the response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful applications we have created for them. 46 | | 47 | */ 48 | 49 | $app->run(); 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Shutdown The Application 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Once the app has finished running, we will fire off the shutdown events 57 | | so that any final work may be done by the application before we shut 58 | | down the process. This is the last thing to happen to the request. 59 | | 60 | */ 61 | 62 | $app->shutdown(); -------------------------------------------------------------------------------- /public/js/angular-cookies.min.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"angular-cookies.min.js", 4 | "lineCount":7, 5 | "mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAoBtCD,CAAAE,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,QAAA,CA4BW,UA5BX,CA4BuB,CAAC,YAAD,CAAe,UAAf,CAA2B,QAAS,CAACC,CAAD,CAAaC,CAAb,CAAuB,CAAA,IACxEC,EAAU,EAD8D,CAExEC,EAAc,EAF0D,CAGxEC,CAHwE,CAIxEC,EAAU,CAAA,CAJ8D,CAKxEC,EAAOV,CAAAU,KALiE,CAMxEC,EAAcX,CAAAW,YAGlBN,EAAAO,UAAA,CAAmB,QAAQ,EAAG,CAC5B,IAAIC,EAAiBR,CAAAC,QAAA,EACjBE,EAAJ,EAA0BK,CAA1B,GACEL,CAGA,CAHqBK,CAGrB,CAFAH,CAAA,CAAKG,CAAL,CAAqBN,CAArB,CAEA,CADAG,CAAA,CAAKG,CAAL,CAAqBP,CAArB,CACA,CAAIG,CAAJ,EAAaL,CAAAU,OAAA,EAJf,CAF4B,CAA9B,CAAA,EAUAL,EAAA,CAAU,CAAA,CAKVL,EAAAW,OAAA,CASAC,QAAa,EAAG,CAAA,IACVC,CADU,CAEVC,CAFU,CAIVC,CAGJ,KAAKF,CAAL,GAAaV,EAAb,CACMI,CAAA,CAAYL,CAAA,CAAQW,CAAR,CAAZ,CAAJ,EACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBhB,CAAvB,CAKJ,KAAIgB,CAAJ,GAAYX,EAAZ,CAEE,CADAY,CACK,CADGZ,CAAA,CAAQW,CAAR,CACH,CAAAjB,CAAAoB,SAAA,CAAiBF,CAAjB,CAAL,EAMWA,CANX,GAMqBX,CAAA,CAAYU,CAAZ,CANrB,GAOEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBC,CAAvB,CACA,CAAAC,CAAA,CAAU,CAAA,CARZ,EACMnB,CAAAqB,UAAA,CAAkBd,CAAA,CAAYU,CAAZ,CAAlB,CAAJ,CACEX,CAAA,CAAQW,CAAR,CADF,CACkBV,CAAA,CAAYU,CAAZ,CADlB,CAGE,OAAOX,CAAA,CAAQW,CAAR,CASb,IAAIE,CAAJ,CAIE,IAAKF,CAAL,GAFAK,EAEahB,CAFID,CAAAC,QAAA,EAEJA,CAAAA,CAAb,CACMA,CAAA,CAAQW,CAAR,CAAJ,GAAsBK,CAAA,CAAeL,CAAf,CAAtB,GAEMN,CAAA,CAAYW,CAAA,CAAeL,CAAf,CAAZ,CAAJ,CACE,OAAOX,CAAA,CAAQW,CAAR,CADT,CAGEX,CAAA,CAAQW,CAAR,CAHF,CAGkBK,CAAA,CAAeL,CAAf,CALpB,CAlCU,CAThB,CAEA;MAAOX,EA1BqE,CAA3D,CA5BvB,CAAAH,QAAA,CA4HW,cA5HX,CA4H2B,CAAC,UAAD,CAAa,QAAQ,CAACoB,CAAD,CAAW,CAErD,MAAO,KAYAC,QAAQ,CAACC,CAAD,CAAM,CAEjB,MAAO,CADHP,CACG,CADKK,CAAA,CAASE,CAAT,CACL,EAAQzB,CAAA0B,SAAA,CAAiBR,CAAjB,CAAR,CAAkCA,CAFxB,CAZd,KA4BAS,QAAQ,CAACF,CAAD,CAAMP,CAAN,CAAa,CACxBK,CAAA,CAASE,CAAT,CAAA,CAAgBzB,CAAA4B,OAAA,CAAeV,CAAf,CADQ,CA5BrB,QA0CGW,QAAQ,CAACJ,CAAD,CAAM,CACpB,OAAOF,CAAA,CAASE,CAAT,CADa,CA1CjB,CAF8C,CAAhC,CA5H3B,CApBsC,CAArC,CAAA,CAoME1B,MApMF,CAoMUA,MAAAC,QApMV;", 6 | "sources":["angular-cookies.js"], 7 | "names":["window","angular","undefined","module","factory","$rootScope","$browser","cookies","lastCookies","lastBrowserCookies","runEval","copy","isUndefined","addPollFn","currentCookies","$apply","$watch","push","name","value","updated","isString","isDefined","browserCookies","$cookies","get","key","fromJson","put","toJson","remove"] 8 | } 9 | -------------------------------------------------------------------------------- /public/js/angularjs.cookies.1.2.4.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.4 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(d,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&d.$apply())})();k=!0;d.$watch(function(){var a,e,d;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)(e=c[a],f.isString(e))?e!==g[a]&&(b.cookies(a,e),d=!0):f.isDefined(g[a])?c[a]=g[a]:delete c[a];if(d)for(a in e=b.cookies(),c)c[a]!==e[a]&&(m(e[a])?delete c[a]:c[a]=e[a])}); 7 | return c}]).factory("$cookieStore",["$cookies",function(d){return{get:function(b){return(b=d[b])?f.fromJson(b):b},put:function(b,c){d[b]=f.toJson(c)},remove:function(b){delete d[b]}}}])})(window,window.angular); 8 | //# sourceMappingURL=angular-cookies.min.js.map -------------------------------------------------------------------------------- /public/js/bootstrap.3.0.3.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.0.3 (http://getbootstrap.com) 3 | * Copyright 2013 Twitter, Inc. 4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0 5 | */ 6 | 7 | if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); -------------------------------------------------------------------------------- /public/js/shared.js: -------------------------------------------------------------------------------- 1 | var app = angular.module("app", ["ngCookies"]); 2 | 3 | app.factory("CategoryService", function($http) { 4 | return { 5 | "getCategories": function() { 6 | return $http.get("/category/index"); 7 | } 8 | }; 9 | }); 10 | 11 | app.factory("ProductService", function($http) { 12 | return { 13 | "getProducts": function() { 14 | return $http.get("/product/index"); 15 | } 16 | }; 17 | }); 18 | 19 | app.factory("BasketService", function($cookies) { 20 | 21 | var products = JSON.parse($cookies.products || "[]"); 22 | 23 | return { 24 | 25 | "getProducts" : function() { 26 | return products; 27 | }, 28 | 29 | "add" : function(product) { 30 | 31 | products.push({ 32 | "id" : product.id, 33 | "name" : product.name, 34 | "price" : product.price, 35 | "total" : product.price * 1, 36 | "quantity" : 1 37 | }); 38 | 39 | this.store(); 40 | }, 41 | 42 | "remove" : function(product) { 43 | 44 | for (var i = 0; i < products.length; i++) { 45 | 46 | var next = products[i]; 47 | 48 | if (next.id == product.id) { 49 | products.splice(i, 1); 50 | } 51 | 52 | } 53 | 54 | this.store(); 55 | 56 | }, 57 | 58 | "update": function() { 59 | 60 | for (var i = 0; i < products.length; i++) { 61 | 62 | var product = products[i]; 63 | var raw = product.quantity * product.price; 64 | 65 | product.total = Math.round(raw * 100) / 100; 66 | 67 | } 68 | 69 | this.store(); 70 | 71 | }, 72 | 73 | "store" : function() { 74 | $cookies.products = JSON.stringify(products); 75 | }, 76 | 77 | "clear" : function() { 78 | products.length = 0; 79 | this.store(); 80 | } 81 | 82 | }; 83 | 84 | }); 85 | 86 | app.factory("AccountService", function( 87 | $http 88 | ) { 89 | 90 | var account = null; 91 | 92 | return { 93 | "authenticate": function(email, password) { 94 | 95 | var request = $http.post("/account/authenticate", { 96 | "email" : email, 97 | "password" : password 98 | }); 99 | 100 | request.success(function(data) { 101 | if (data.status !== "error") { 102 | account = data.account; 103 | } 104 | }); 105 | 106 | return request; 107 | 108 | }, 109 | "getAccount": function() { 110 | return account; 111 | } 112 | }; 113 | }); 114 | 115 | app.factory("OrderService", function( 116 | $http, 117 | AccountService, 118 | BasketService 119 | ) { 120 | return { 121 | "pay": function(number, expiry, security) { 122 | 123 | var account = AccountService.getAccount(); 124 | var products = BasketService.getProducts(); 125 | var items = []; 126 | 127 | for (var i = 0; i < products.length; i++) { 128 | 129 | var product = products[i]; 130 | 131 | items.push({ 132 | "product_id" : product.id, 133 | "quantity" : product.quantity 134 | }); 135 | 136 | } 137 | 138 | return $http.post("/order/add", { 139 | "account" : account.id, 140 | "items" : JSON.stringify(items), 141 | "number" : number, 142 | "expiry" : expiry, 143 | "security" : security 144 | }); 145 | } 146 | }; 147 | }); 148 | 149 | app.controller("products", function( 150 | $scope, 151 | CategoryService, 152 | ProductService, 153 | BasketService 154 | ) { 155 | 156 | var self = this; 157 | 158 | var categories = CategoryService.getCategories(); 159 | 160 | categories.success(function(data) { 161 | self.categories = data; 162 | }); 163 | 164 | var products = ProductService.getProducts(); 165 | 166 | products.success(function(data) { 167 | self.products = data; 168 | }); 169 | 170 | this.category = null; 171 | 172 | this.filterByCategory = function(product) { 173 | 174 | if (self.category !== null) { 175 | return product.category.id === self.category.id; 176 | } 177 | 178 | return true; 179 | 180 | }; 181 | 182 | this.setCategory = function(category) { 183 | self.category = category; 184 | }; 185 | 186 | this.addToBasket = function(product) { 187 | BasketService.add(product); 188 | }; 189 | 190 | $scope.products = this; 191 | 192 | }); 193 | 194 | app.controller("main", function($scope) { 195 | $scope.main = this; 196 | }); 197 | 198 | app.controller("basket", function( 199 | $scope, 200 | AccountService, 201 | BasketService, 202 | OrderService 203 | ) { 204 | 205 | var self = this; 206 | 207 | this.products = BasketService.getProducts(); 208 | 209 | this.update = function() { 210 | BasketService.update(); 211 | }; 212 | 213 | this.remove = function(product) { 214 | BasketService.remove(product); 215 | }; 216 | 217 | this.state = "shopping"; 218 | this.email = ""; 219 | this.password = ""; 220 | this.number = ""; 221 | this.expiry = ""; 222 | this.secutiry = ""; 223 | 224 | this.authenticate = function() { 225 | 226 | var details = AccountService.authenticate(self.email, self.password); 227 | 228 | details.success(function(data) { 229 | if (data.status == "ok") { 230 | self.state = "paying"; 231 | } 232 | }); 233 | 234 | } 235 | 236 | this.pay = function() { 237 | 238 | var details = OrderService.pay( 239 | self.number, 240 | self.expiry, 241 | self.security 242 | ); 243 | 244 | details.success(function(data) { 245 | BasketService.clear(); 246 | self.state = "shopping"; 247 | }); 248 | 249 | } 250 | 251 | $scope.basket = this; 252 | 253 | }); -------------------------------------------------------------------------------- /public/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/public/packages/.gitkeep -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /vagrant_manifests/default.pp: -------------------------------------------------------------------------------- 1 | Exec { 2 | path => [ 3 | "/usr/sbin", 4 | "/usr/bin", 5 | "/sbin", 6 | "/bin" 7 | ] 8 | } 9 | 10 | include base 11 | include mysql 12 | include memcache 13 | include nginx 14 | include php -------------------------------------------------------------------------------- /vagrant_modules/base/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class base { 2 | 3 | exec { "apt-update": 4 | command => "sudo apt-get update" 5 | } 6 | 7 | } -------------------------------------------------------------------------------- /vagrant_modules/memcache/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class memcache { 2 | 3 | Class["mysql"] -> Class["memcache"] 4 | 5 | package { "memcached": 6 | ensure => present 7 | } 8 | 9 | file { "/etc/memcached.conf": 10 | ensure => file, 11 | content => template("memcache/memcached.conf.erb"), 12 | require => Package["memcached"] 13 | } 14 | 15 | service { "memcached": 16 | ensure => running, 17 | subscribe => File["/etc/memcached.conf"] 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /vagrant_modules/memcache/templates/memcached.conf.erb: -------------------------------------------------------------------------------- 1 | # memcached default config file 2 | # 2003 - Jay Bonci 3 | # This configuration file is read by the start-memcached script provided as 4 | # part of the Debian GNU/Linux distribution. 5 | 6 | # Run memcached as a daemon. This command is implied, and is not needed for the 7 | # daemon to run. See the README.Debian that comes with this package for more 8 | # information. 9 | -d 10 | 11 | # Log memcached's output to /var/log/memcached 12 | logfile /var/log/memcached.log 13 | 14 | # Be verbose 15 | # -v 16 | 17 | # Be even more verbose (print client commands as well) 18 | # -vv 19 | 20 | # Start with a cap of 64 megs of memory. It's reasonable, and the daemon default 21 | # Note that the daemon will grow to this size, but does not start out holding this much 22 | # memory 23 | -m 64 24 | 25 | # Default connection port is 11211 26 | -p 11211 27 | 28 | # Run the daemon as root. The start-memcached will default to running as root if no 29 | # -u command is present in this config file 30 | -u memcache 31 | 32 | # Specify which IP address to listen on. The default is to listen on all IP addresses 33 | # This parameter is one of the only security measures that memcached has, so make sure 34 | # it's listening on a firewalled interface. 35 | -l 127.0.0.1 36 | 37 | # Limit the number of simultaneous incoming connections. The daemon default is 1024 38 | # -c 1024 39 | 40 | # Lock down all paged memory. Consult with the README and homepage before you do this 41 | # -k 42 | 43 | # Return error when memory is exhausted (rather than removing items) 44 | # -M 45 | 46 | # Maximize core file limit 47 | # -r 48 | -------------------------------------------------------------------------------- /vagrant_modules/mysql/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class mysql { 2 | 3 | Class["base"] -> Class["mysql"] 4 | 5 | include mysql::params 6 | 7 | package { "mysql-server": 8 | ensure => present 9 | } 10 | 11 | file { "/etc/my.cnf": 12 | ensure => file, 13 | content => template("mysql/my.cnf.erb"), 14 | require => Package["mysql-server"] 15 | } 16 | 17 | service { "mysql": 18 | ensure => running, 19 | subscribe => File["/etc/my.cnf"] 20 | } 21 | 22 | exec { "mysql-root-password": 23 | command => "mysqladmin -u root password '${mysql::params::root}'", 24 | require => Service["mysql"], 25 | unless => "mysql -u root -p${mysql::params::root}" 26 | } 27 | 28 | exec { "mysql-user": 29 | command => "echo \"CREATE USER '${mysql::params::user}'@'localhost' IDENTIFIED BY '${mysql::params::password}';\" | mysql -u root -p${mysql::params::root}", 30 | require => Exec["mysql-root-password"], 31 | unless => "mysql -u ${mysql::params::user} -p${mysql::params::password}" 32 | } 33 | 34 | exec { "mysql-database": 35 | command => "echo \"CREATE DATABASE ${mysql::params::database}; GRANT ALL ON ${mysql::params::database}.* TO '${mysql::params::user}'@'localhost';\" | mysql -u root -p${mysql::params::root}", 36 | require => Exec["mysql-user"], 37 | unless => "mysql -u ${mysql::params::user} -p${mysql::params::password} ${mysql::params::database}" 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /vagrant_modules/mysql/manifests/params.pp: -------------------------------------------------------------------------------- 1 | class mysql::params { 2 | $root = "dev" 3 | $user = "dev" 4 | $password = "dev" 5 | $database = "dev" 6 | } -------------------------------------------------------------------------------- /vagrant_modules/mysql/templates/my.cnf.erb: -------------------------------------------------------------------------------- 1 | # Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 2 | # Configuration name dev generated for info@joshlockhart.com at 2013-11-12 03:23:44 3 | 4 | [mysql] 5 | 6 | # CLIENT # 7 | port = 3306 8 | socket = /var/lib/mysql/mysql.sock 9 | 10 | [mysqld] 11 | 12 | # GENERAL # 13 | user = mysql 14 | default-storage-engine = InnoDB 15 | socket = /var/lib/mysql/mysql.sock 16 | pid-file = /var/lib/mysql/mysql.pid 17 | 18 | # MyISAM # 19 | key-buffer-size = 32M 20 | myisam-recover = FORCE,BACKUP 21 | 22 | # SAFETY # 23 | max-allowed-packet = 16M 24 | max-connect-errors = 1000000 25 | innodb = FORCE 26 | 27 | # DATA STORAGE # 28 | datadir = /var/lib/mysql/ 29 | 30 | # BINARY LOGGING # 31 | log-bin = /var/lib/mysql/mysql-bin 32 | expire-logs-days = 14 33 | sync-binlog = 1 34 | 35 | # CACHES AND LIMITS # 36 | tmp-table-size = 32M 37 | max-heap-table-size = 32M 38 | query-cache-type = 1 39 | query-cache-size = 50M 40 | max-connections = 500 41 | thread-cache-size = 50 42 | open-files-limit = 65535 43 | table-definition-cache = 1024 44 | table-open-cache = 2048 45 | 46 | # INNODB # 47 | innodb-flush-method = O_DIRECT 48 | innodb-log-files-in-group = 2 49 | innodb-log-file-size = 64M 50 | innodb-flush-log-at-trx-commit = 1 51 | innodb-file-per-table = 1 52 | innodb-buffer-pool-size = 384M 53 | 54 | # LOGGING # 55 | log-error = /var/lib/mysql/mysql-error.log 56 | log-queries-not-using-indexes = 1 57 | slow-query-log = 1 58 | slow-query-log-file = /var/lib/mysql/mysql-slow.log 59 | -------------------------------------------------------------------------------- /vagrant_modules/nginx/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class nginx { 2 | 3 | Class["memcache"] -> Class["nginx"] 4 | 5 | include nginx::params 6 | 7 | package { "nginx": 8 | ensure => present 9 | } 10 | 11 | exec { "permissions": 12 | command => "sudo chown -R www-data:www-data /var/www" 13 | } 14 | 15 | file { "/etc/nginx/nginx.conf": 16 | ensure => file, 17 | content => template("nginx/nginx.conf.erb"), 18 | require => Package["nginx"] 19 | } 20 | 21 | file { "/etc/nginx/sites-enabled/${nginx::params::domain}": 22 | ensure => file, 23 | content => template("nginx/default.erb"), 24 | require => File["/etc/nginx/nginx.conf"] 25 | } 26 | 27 | service { "nginx": 28 | ensure => running, 29 | subscribe => [ 30 | File["/etc/nginx/sites-enabled/${nginx::params::domain}"] 31 | ], 32 | require => File["/etc/nginx/sites-enabled/${nginx::params::domain}"] 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /vagrant_modules/nginx/manifests/params.pp: -------------------------------------------------------------------------------- 1 | class nginx::params { 2 | $domain = "default" 3 | } 4 | -------------------------------------------------------------------------------- /vagrant_modules/nginx/templates/default.erb: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | listen 80; 4 | 5 | server_name <%= scope.lookupvar('nginx::params::domain') %>; 6 | 7 | root /var/www/public; 8 | 9 | include fastcgi_params; 10 | 11 | location / { 12 | index index.php; 13 | try_files $uri $uri/ /index.php$is_args$args; 14 | } 15 | 16 | location ~ \.php$ { 17 | fastcgi_pass unix:/var/run/php5-fpm.sock; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /vagrant_modules/nginx/templates/nginx.conf.erb: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /var/run/nginx.pid; 4 | 5 | events { 6 | worker_connections 768; 7 | # multi_accept on; 8 | } 9 | 10 | http { 11 | 12 | ## 13 | # Basic Settings 14 | ## 15 | 16 | sendfile off; 17 | tcp_nopush on; 18 | tcp_nodelay on; 19 | keepalive_timeout 65; 20 | types_hash_max_size 2048; 21 | # server_tokens off; 22 | 23 | # server_names_hash_bucket_size 64; 24 | # server_name_in_redirect off; 25 | 26 | include /etc/nginx/mime.types; 27 | default_type application/octet-stream; 28 | 29 | ## 30 | # Logging Settings 31 | ## 32 | 33 | access_log /var/log/nginx/access.log; 34 | error_log /var/log/nginx/error.log; 35 | 36 | ## 37 | # Gzip Settings 38 | ## 39 | 40 | gzip on; 41 | gzip_disable "msie6"; 42 | 43 | # gzip_vary on; 44 | # gzip_proxied any; 45 | # gzip_comp_level 6; 46 | # gzip_buffers 16 8k; 47 | # gzip_http_version 1.1; 48 | # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 49 | 50 | ## 51 | # nginx-naxsi config 52 | ## 53 | # Uncomment it if you installed nginx-naxsi 54 | ## 55 | 56 | #include /etc/nginx/naxsi_core.rules; 57 | 58 | ## 59 | # nginx-passenger config 60 | ## 61 | # Uncomment it if you installed nginx-passenger 62 | ## 63 | 64 | #passenger_root /usr; 65 | #passenger_ruby /usr/bin/ruby; 66 | 67 | ## 68 | # Virtual Host Configs 69 | ## 70 | 71 | include /etc/nginx/conf.d/*.conf; 72 | include /etc/nginx/sites-enabled/*; 73 | } 74 | 75 | 76 | #mail { 77 | # # See sample authentication script at: 78 | # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript 79 | # 80 | # # auth_http localhost/auth.php; 81 | # # pop3_capabilities "TOP" "USER"; 82 | # # imap_capabilities "IMAP4rev1" "UIDPLUS"; 83 | # 84 | # server { 85 | # listen localhost:110; 86 | # protocol pop3; 87 | # proxy on; 88 | # } 89 | # 90 | # server { 91 | # listen localhost:143; 92 | # protocol imap; 93 | # proxy on; 94 | # } 95 | #} -------------------------------------------------------------------------------- /vagrant_modules/php/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class php ( 2 | $path = "/usr/bin/php" 3 | ) { 4 | 5 | Class["nginx"] -> Class["php"] 6 | 7 | exec { "prepare-for-repository": 8 | command => "sudo apt-get install -y python-software-properties" 9 | } 10 | 11 | exec { "add-repository": 12 | command => "sudo add-apt-repository -y ppa:ondrej/php5", 13 | require => Exec["prepare-for-repository"] 14 | } 15 | 16 | exec { "update": 17 | command => "sudo apt-get update -y", 18 | require => Exec["add-repository"] 19 | } 20 | 21 | exec { "install-php": 22 | command => "sudo apt-get install -y php5-cli php5-common php5-mysql php5-gd php5-fpm php5-cgi php-pear php5-memcache php5-memcached php-apc php-soap php-xml-serializer php-xml-parser php5-geoip php5-mcrypt php5-curl php5-json", 23 | require => Exec["update"] 24 | } 25 | 26 | file { "/etc/php5/cgi/php.ini": 27 | ensure => file, 28 | content => template("php/php.ini.erb"), 29 | require => Exec["install-php"] 30 | } 31 | 32 | file { "/etc/php5/cli/php.ini": 33 | ensure => file, 34 | content => template("php/php.ini.erb"), 35 | require => Exec["install-php"] 36 | } 37 | 38 | file { "/etc/php5/fpm/php.ini": 39 | ensure => file, 40 | content => template("php/php.ini.erb"), 41 | require => Exec["install-php"] 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | 6 | config.vm.box = "precise64" 7 | 8 | config.vm.box_url = "http://files.vagrantup.com/precise64.box" 9 | 10 | config.vm.network :forwarded_port, guest: 80, host: 8080 11 | 12 | config.vm.synced_folder ".", "/var/www", :owner => "www-data", :group => "www-data", :fmode => "777" 13 | 14 | config.vm.provider :virtualbox do |vb| 15 | 16 | vb.customize ["modifyvm", :id, "--memory", "1024"] 17 | 18 | end 19 | 20 | config.vm.provision :puppet do |puppet| 21 | 22 | puppet.manifests_path = "vagrant_manifests" 23 | puppet.manifest_file = "default.pp" 24 | 25 | puppet.module_path = "vagrant_modules" 26 | 27 | end 28 | 29 | end -------------------------------------------------------------------------------- /workbench/formativ/billing/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store -------------------------------------------------------------------------------- /workbench/formativ/billing/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.3 5 | - 5.4 6 | - 5.5 7 | 8 | before_script: 9 | - curl -s http://getcomposer.org/installer | php 10 | - php composer.phar install --dev 11 | 12 | script: phpunit -------------------------------------------------------------------------------- /workbench/formativ/billing/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "formativ/billing", 3 | "description": "", 4 | "authors": [ 5 | { 6 | "name": "", 7 | "email": "" 8 | } 9 | ], 10 | "require": { 11 | "php": ">=5.3.0", 12 | "illuminate/support": "4.0.x" 13 | }, 14 | "autoload": { 15 | "psr-0": { 16 | "Formativ\\Billing": "src/" 17 | } 18 | }, 19 | "minimum-stability": "dev" 20 | } -------------------------------------------------------------------------------- /workbench/formativ/billing/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./tests/ 16 | 17 | 18 | -------------------------------------------------------------------------------- /workbench/formativ/billing/src/Formativ/Billing/BillingServiceProvider.php: -------------------------------------------------------------------------------- 1 | subject("Your invoice!"); 18 | $message->from("info@example.com", "Laravel 4 E-Commerce"); 19 | $message->to($order->account->email); 20 | 21 | $message->attach($document, [ 22 | "as" => "Invoice " . $order->id, 23 | "mime" => "application/pdf" 24 | ]); 25 | }); 26 | } 27 | } -------------------------------------------------------------------------------- /workbench/formativ/billing/src/Formativ/Billing/GatewayInterface.php: -------------------------------------------------------------------------------- 1 | $order 15 | ]); 16 | 17 | define("DOMPDF_ENABLE_AUTOLOAD", false); 18 | 19 | require_once base_path() . "/vendor/dompdf/dompdf/dompdf_config.inc.php"; 20 | 21 | $dompdf = new DOMPDF(); 22 | $dompdf->load_html($view); 23 | $dompdf->set_paper("a4", "portrait"); 24 | 25 | $dompdf->render(); 26 | $results = $dompdf->output(); 27 | 28 | $temp = storage_path() . "/order-" . $order->id . ".pdf"; 29 | file_put_contents($temp, $results); 30 | 31 | return $temp; 32 | } 33 | } -------------------------------------------------------------------------------- /workbench/formativ/billing/src/Formativ/Billing/StripeGateway.php: -------------------------------------------------------------------------------- 1 | [ 26 | "number" => $number, 27 | "exp_month" => $expiry[0], 28 | "exp_year" => $expiry[1] 29 | ], 30 | "amount" => round($amount * 100), 31 | "currency" => $currency 32 | ]); 33 | 34 | return true; 35 | } 36 | catch (Exception $e) 37 | { 38 | return false; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /workbench/formativ/billing/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assertchris/tutorial-laravel-4-e-commerce/f3610cb31d07ffca090e8d73958255642e47042f/workbench/formativ/billing/tests/.gitkeep --------------------------------------------------------------------------------