Compare commits

..

No commits in common. "main" and "1.3" have entirely different histories.
main ... 1.3

4 changed files with 8 additions and 10 deletions

View File

@ -26,13 +26,13 @@ class MakeAction extends Command
*/
public function handle()
{
$name = ! empty($this->argument('name'))
$name = $this->hasArgument('name')
? $this->argument('name')
: $this->ask('What is the name of the action?', 'MakeSmoothie');
$contents = file_get_contents(__DIR__.'/../stubs/action.php');
$contents = str_replace('MakeSmoothie', $name, $contents);
$contents = str_replace('make-smoothie', Str::snake($name, '-'), $contents);
$contents = str_replace('make-smoothie', Str::slug($name), $contents);
$path = app_path('Pilot/Actions/'.$name.'.php');
if (file_exists($path)) {

View File

@ -26,13 +26,13 @@ class MakeMetric extends Command
*/
public function handle()
{
$name = ! empty($this->argument('name'))
$name = $this->hasArgument('name')
? $this->argument('name')
: $this->ask('What is the name of the metric?', 'SmoothiesCount');
$contents = file_get_contents(__DIR__.'/../stubs/metric.php');
$contents = str_replace('SmoothiesCount', $name, $contents);
$contents = str_replace('smoothies-count', Str::snake($name, '-'), $contents);
$contents = str_replace('smoothies-count', Str::slug($name), $contents);
$path = app_path('Pilot/Metrics/'.$name.'.php');
if (file_exists($path)) {

View File

@ -85,7 +85,7 @@ class PilotServiceProvider extends ServiceProvider
abort(403);
}
$output = $this->pilot->handle($request->all(), $request->allFiles());
$output = $this->pilot->handle($request->all(), $request->files->all());
if (isset($output['json'])) {
return response()->json($output['json']);

View File

@ -29,9 +29,7 @@ class Pilot
{
$this->register('form', $slug, function () use ($function) {
return [
'json' => [
'form' => $function()
],
'json' => $function(),
];
});
}
@ -53,8 +51,8 @@ class Pilot
public function handle($data = [], $files = [])
{
$type = $data['_type'] ?? null;
$slug = $data['_slug'] ?? null;
$type = $data['type'] ?? null;
$slug = $data['slug'] ?? null;
if (isset($this->registry[$type]) && isset($this->registry[$type][$slug])) {
$params = $this->resolveDependencies($slug, $this->registry[$type][$slug], $data, $files);