Skip to content

Commit

Permalink
fix new player
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jun 16, 2023
1 parent 94ad0cc commit f70fe49
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
17 changes: 12 additions & 5 deletions app/Http/Controllers/Sources/WebHookSourceController.php
Expand Up @@ -11,13 +11,20 @@ class WebHookSourceController extends BaseSourceController
{
public function create(Project $project)
{
return inertia('Sources/WebHook/Create', [
'details' => config('larachain.sources.web_hook'),
'project' => $project,
'source' => [
'meta_data' => [],

$source = Source::create([
'name' => 'Your webhook',
'description' => 'Some info',
'project_id' => $project->id,
'meta_data' => [
'auth' => 'coming soon....',
],
]);

return to_route('sources.web_hook.edit', [
'source' => $source->id,
'project' => $project->id,
]);
}

public function edit(Project $project, Source $source)
Expand Down
14 changes: 13 additions & 1 deletion resources/js/Pages/Sources/WebHook/Edit.vue
Expand Up @@ -17,6 +17,18 @@
{{ details.description }}
</template>

<template #form_description>
<div>
The URL you can use for this API is:
<div class="bg-gray-100 p-2">
<ul>
<li><span class="font-semibold">url to send webhooks:</span> {{ usePage().props.app_url }}/api/projects/{{source.project_id}}/sources/{{source.id}}/webhook</li>
<li><span class="font-semibold">method:</span> 'ANY'</li>
</ul>
</div>
</div>
</template>

<template #form>
<ResourceForm v-model="form"/>
</template>
Expand All @@ -42,7 +54,7 @@ import FormSection from "@/Components/FormSection.vue";
import PrimaryButton from '@/Components/PrimaryButton.vue';
import { useForm } from "@inertiajs/vue3";
import { useForm, usePage } from "@inertiajs/vue3";
import {useToast} from "vue-toastification";
import ResourceForm from "./Partials/ResourceForm.vue";
const toast = useToast();
Expand Down
4 changes: 4 additions & 0 deletions resources/js/Pages/Sources/WebHook/Partials/ResourceForm.vue
@@ -1,4 +1,7 @@
<template>



<div class="col-span-6 sm:col-span-6 ">
<InputLabel for="Name" >Name</InputLabel>
<TextInput
Expand Down Expand Up @@ -26,6 +29,7 @@ import InputError from '@/Components/InputError.vue';
import InputLabel from '@/Components/InputLabel.vue';
import TextArea from '@/Components/TextArea.vue';
import TextInput from '@/Components/TextInput.vue';
import { usePage } from "@inertiajs/vue3";
const emit = defineEmits(['update:modeValue']);
const props = defineProps({
Expand Down
Binary file modified tests/.DS_Store
Binary file not shown.
Expand Up @@ -27,9 +27,13 @@ public function testShowFormForURLSourceWebHook()
'team_id' => $user->current_team_id,
]);

$this->assertDatabaseCount('sources', 0);

$response = $this->actingAs($user)->get(route('sources.web_hook.create', ['project' => $project->id]));

$response->assertStatus(200);
$response->assertStatus(302);

$this->assertDatabaseCount('sources', 1);
}

public function testAllowToEditWebHook()
Expand Down

0 comments on commit f70fe49

Please sign in to comment.