-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add collection index and collection add
- Loading branch information
Showing
22 changed files
with
449 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ APP_NAME=Laravel | |
APP_ENV=local | ||
APP_KEY=base64:zR66Rx/bzt2/cu0BK92ijOXxCpGxoPCVgFEdHxZQa+k= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
APP_URL=http://larachain.test | ||
|
||
LOG_CHANNEL=stack | ||
LOG_DEPRECATIONS_CHANNEL=null | ||
|
@@ -63,8 +63,5 @@ MAPBOX_TOKEN="foobar" | |
[email protected] | ||
ADMIN_ONE_PASSWORD=makeagoodone | ||
|
||
[email protected] | ||
ADMIN_TWO_PASSWORD=makeagoodone | ||
|
||
## Fake key | ||
OPENAI_API_KEY=sk-m8ox9NVgboSLRCr5VA5RT3BXbkFJzP1QGUedbQxGmmuAQWRT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Resources\CollectionResource; | ||
use App\Models\Collection; | ||
use Illuminate\Http\Request; | ||
|
||
class CollectionController extends Controller | ||
{ | ||
|
||
public function index() { | ||
|
||
return inertia("Collection/Index", [ | ||
'collections' => CollectionResource::collection(Collection::query() | ||
->where("team_id", auth()->user()->current_team_id) | ||
->get()) | ||
]); | ||
} | ||
|
||
public function store() { | ||
|
||
$validated = request()->validate([ | ||
'name' => 'required', | ||
'description' => 'required', | ||
]); | ||
|
||
$validated['team_id'] = auth()->user()->current_team_id; | ||
|
||
$collection = Collection::create($validated); | ||
/** | ||
* Make and then reditect to the view page | ||
*/ | ||
request()->session()->flash("flash.banner", "Collection created successfully!"); | ||
|
||
return to_route('collections.show', $collection); | ||
} | ||
|
||
public function show(Collection $collection) { | ||
return inertia("Collection/Show", [ | ||
'collection' => new CollectionResource($collection) | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Resources\Json\JsonResource; | ||
|
||
class CollectionResource extends JsonResource | ||
{ | ||
/** | ||
* Transform the resource into an array. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray(Request $request): array | ||
{ | ||
return parent::toArray($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script setup> | ||
import { Link } from '@inertiajs/vue3'; | ||
defineProps({ | ||
href: { | ||
type: String, | ||
default: "#", | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<Link :href="href" class="inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 focus:bg-gray-700 active:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150"> | ||
<slot /> | ||
</Link> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script setup> | ||
import { onMounted, ref } from 'vue'; | ||
defineProps({ | ||
modelValue: String, | ||
}); | ||
defineEmits(['update:modelValue']); | ||
const input = ref(null); | ||
</script> | ||
|
||
<template> | ||
<textarea | ||
ref="input" | ||
class="border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm" | ||
:value="modelValue" | ||
@input="$emit('update:modelValue', $event.target.value)" | ||
> | ||
</textarea> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<script setup> | ||
import ApplicationLogo from '@/Components/ApplicationLogo.vue'; | ||
import { usePage } from '@inertiajs/vue3'; | ||
const people = [ | ||
{ name: 'Lindsay Walton', title: 'Front-end Developer', email: '[email protected]', role: 'Member' }, | ||
// More people... | ||
] | ||
</script> | ||
|
||
<template> | ||
|
@@ -8,97 +17,14 @@ import ApplicationLogo from '@/Components/ApplicationLogo.vue'; | |
<ApplicationLogo class="block h-12 w-auto" /> | ||
|
||
<h1 class="mt-8 text-2xl font-medium text-gray-900"> | ||
Welcome to your Jetstream application! | ||
Welcome to {{ usePage().props.app_name }}, where your data transformation journey begins! Dive into a seamless experience of managing and analyzing your data with precision and ease. | ||
</h1> | ||
|
||
<p class="mt-6 text-gray-500 leading-relaxed"> | ||
Laravel Jetstream provides a beautiful, robust starting point for your next Laravel application. Laravel is designed | ||
to help you build your application using a development environment that is simple, powerful, and enjoyable. We believe | ||
you should love expressing your creativity through programming, so we have spent time carefully crafting the Laravel | ||
ecosystem to be a breath of fresh air. We hope you love it. | ||
Get started by creating a new 'Collection'—your first step towards organizing diverse data sources like PDFs, website data, and more, into a cohesive unit. Each 'Collection' serves as a centralized hub for your team's data, making it easier to collaborate, analyze, and derive actionable insights. Simply select or switch your team from the menu, and create or access your Collections to embark on a streamlined data management journey. Ready to unlock the full potential of your data? Let's create your first Collection and set the foundation for unparalleled team collaboration and insight discovery. | ||
</p> | ||
</div> | ||
|
||
<div class="bg-gray-200 bg-opacity-25 grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8 p-6 lg:p-8"> | ||
<div> | ||
<div class="flex items-center"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" class="w-6 h-6 stroke-gray-400"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /> | ||
</svg> | ||
<h2 class="ms-3 text-xl font-semibold text-gray-900"> | ||
<a href="https://laravel.com/docs">Documentation</a> | ||
</h2> | ||
</div> | ||
|
||
<p class="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
Laravel has wonderful documentation covering every aspect of the framework. Whether you're new to the framework or have previous experience, we recommend reading all of the documentation from beginning to end. | ||
</p> | ||
|
||
<p class="mt-4 text-sm"> | ||
<a href="https://laravel.com/docs" class="inline-flex items-center font-semibold text-indigo-700"> | ||
Explore the documentation | ||
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" class="ms-1 w-5 h-5 fill-indigo-500"> | ||
<path fill-rule="evenodd" d="M5 10a.75.75 0 01.75-.75h6.638L10.23 7.29a.75.75 0 111.04-1.08l3.5 3.25a.75.75 0 010 1.08l-3.5 3.25a.75.75 0 11-1.04-1.08l2.158-1.96H5.75A.75.75 0 015 10z" clip-rule="evenodd" /> | ||
</svg> | ||
</a> | ||
</p> | ||
</div> | ||
|
||
<div> | ||
<div class="flex items-center"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" class="w-6 h-6 stroke-gray-400"> | ||
<path stroke-linecap="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z" /> | ||
</svg> | ||
<h2 class="ms-3 text-xl font-semibold text-gray-900"> | ||
<a href="https://laracasts.com">Laracasts</a> | ||
</h2> | ||
</div> | ||
|
||
<p class="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. | ||
</p> | ||
|
||
<p class="mt-4 text-sm"> | ||
<a href="https://laracasts.com" class="inline-flex items-center font-semibold text-indigo-700"> | ||
Start watching Laracasts | ||
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" class="ms-1 w-5 h-5 fill-indigo-500"> | ||
<path fill-rule="evenodd" d="M5 10a.75.75 0 01.75-.75h6.638L10.23 7.29a.75.75 0 111.04-1.08l3.5 3.25a.75.75 0 010 1.08l-3.5 3.25a.75.75 0 11-1.04-1.08l2.158-1.96H5.75A.75.75 0 015 10z" clip-rule="evenodd" /> | ||
</svg> | ||
</a> | ||
</p> | ||
</div> | ||
|
||
<div> | ||
<div class="flex items-center"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" class="w-6 h-6 stroke-gray-400"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" /> | ||
</svg> | ||
<h2 class="ms-3 text-xl font-semibold text-gray-900"> | ||
<a href="https://tailwindcss.com/">Tailwind</a> | ||
</h2> | ||
</div> | ||
|
||
<p class="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
Laravel Jetstream is built with Tailwind, an amazing utility first CSS framework that doesn't get in your way. You'll be amazed how easily you can build and maintain fresh, modern designs with this wonderful framework at your fingertips. | ||
</p> | ||
</div> | ||
|
||
<div> | ||
<div class="flex items-center"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" class="w-6 h-6 stroke-gray-400"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z" /> | ||
</svg> | ||
<h2 class="ms-3 text-xl font-semibold text-gray-900"> | ||
Authentication | ||
</h2> | ||
</div> | ||
|
||
<p class="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
Authentication and registration views are included with Laravel Jetstream, as well as support for user email verification and resetting forgotten passwords. So, you're free to get started with what matters most: building your application. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<div class="grid grid-cols-6 gap-4"> | ||
|
||
<div class="col-span-6 sm:col-span-6"> | ||
<InputLabel value="Name" /> | ||
<TextInput v-model="modelValue.name" type="text" class="mt-1 block w-full" /> | ||
<InputError :message="modelValue.errors.name" class="mt-2" /> | ||
</div> | ||
<div class="col-span-6 sm:col-span-6"> | ||
<InputLabel value="Description (ai will use this to help understand the data)" /> | ||
<TextArea v-model="modelValue.description" type="text" class="mt-1 block w-full" /> | ||
<InputError :message="modelValue.errors.description" class="mt-2" /> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import InputError from '@/Components/InputError.vue'; | ||
import InputLabel from '@/Components/InputLabel.vue'; | ||
import TextInput from '@/Components/TextInput.vue'; | ||
import TextArea from '@/Components/TextArea.vue'; | ||
const props = defineProps({ | ||
modelValue: Object, | ||
}); | ||
</script> |
Oops, something went wrong.