Cachet is now a Laravel 5 app

This commit is contained in:
Joseph Cohen
2015-03-20 18:30:45 -06:00
parent 7cfa158e68
commit b4ac66d727
338 changed files with 4164 additions and 4114 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace CachetHQ\Cachet\Http\Middleware;
use CachetHQ\Cachet\Facades\Setting;
use Closure;
class AllowedDomains
{
/**
* Run the allowed domains middleware.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
// Always allow our own domain.
$ourDomain = Setting::get('app_domain');
$response->headers->set('Access-Control-Allow-Origin', $ourDomain);
// Should we allow anyone else?
if ($allowedDomains = Setting::get('allowed_domains')) {
$domains = explode(',', $allowedDomains);
foreach ($domains as $domain) {
$response->headers->set('Access-Control-Allow-Origin', $domain);
}
}
return $response;
}
}