Initial Spark Install

This commit is contained in:
Deon George
2017-11-03 16:26:07 +11:00
commit b1a5807eb3
766 changed files with 128896 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Laravel\Spark;
use Illuminate\Support\Str;
use GuzzleHttp\Client as HttpClient;
trait InteractsWithSparkApi
{
/**
* Get the latest Spark release version.
*
* @param string|null $major
* @return string
*/
protected function latestSparkRelease($major = null)
{
$response = json_decode((string) (new HttpClient)->get(
$this->sparkUrl.'/api/releases/all-versions'
)->getBody());
return collect($response)->filter(function ($version) use ($major) {
return ! $major || Str::startsWith($version, $major);
})->sort('version_compare')->last();
}
/**
* The Spark base URL.
*
* @var string
*/
protected $sparkUrl = 'https://spark.laravel.com';
}