updated various snippets
This commit is contained in:
parent
1bc953bc44
commit
e27b91fc14
@ -19,10 +19,11 @@
|
||||
<meta name="rating" content="General">
|
||||
|
||||
<meta name="url" content="{{ url('/') }}">
|
||||
<meta name="subject" content="your website's subject">
|
||||
<meta name="description" content="A description of the page">
|
||||
<meta name="subject" content="{{$pageSubject ?? "your website's subject" }}"">
|
||||
<meta name="description" content="{{ $pageDescription ?? 'A description of the page' }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
<meta name="application-name" content="Application Name">
|
||||
|
||||
<!-- Privacy -->
|
||||
<meta name="twitter:dnt" content="on">
|
||||
@ -31,33 +32,41 @@
|
||||
<!-- -->
|
||||
|
||||
<!-- Helps prevent duplicate content issues -->
|
||||
<link href="{{ route()->current() }}" rel="canonical">
|
||||
{{-- <link href="{{ route()->current() }}" rel="canonical"> --}}
|
||||
|
||||
<!-- Gives a reference to a location in your document that may be in another language -->
|
||||
<link href="#" rel="alternate" hreflang="de">
|
||||
{{-- <link href="#" rel="alternate" hreflang="de"> --}}
|
||||
|
||||
<link href="{{ url('copyright.html') }}" rel="copyright" integrity="{{ env('INTEGRITY_HASH_COPYRIGHT_HTML') }}">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link href="{{ url('/favicon.ico') }}" rel="icon" sizes="16x16" type="image/icon">
|
||||
<link href="{{ url('/favicon.svg') }}" rel="icon" type="image/svg+xml">
|
||||
<link href="{{ url('/favicon.png') }}" rel="icon" sizes="192x192">
|
||||
<link href="{{ url('/favicon.ico') }}" rel="icon" sizes="16x16" type="image/icon" integrity="{{ env('INTEGRITY_HASH_FAVICON_ICO') }}">
|
||||
<link href="{{ url('/favicon.svg') }}" rel="icon" type="image/svg+xml" integrity="{{ env('INTEGRITY_HASH_FAVICON_SVG') }}">
|
||||
<link href="{{ url('/favicon.png') }}" rel="icon" sizes="192x192" integrity="{{ env('INTEGRITY_HASH_FAVICON_PNG') }}">
|
||||
|
||||
<!-- Font preloads (should be done for each font file) -->
|
||||
<link href="{{ asset('fonts/fontfam/font.woff2') }}" rel="preload" as="font" type="font/woff2" crossorigin="anonymous">
|
||||
<link href="{{ url('fonts/fontfam/font.woff2') }}" rel="preload" as="font" type="font/woff2" crossorigin="anonymous">
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet" media="screen">
|
||||
<link href="{{ mix('css/app.css') }}" rel="stylesheet" media="all" integrity="{{ env('INTEGRITY_HASH_APP_CSS') }}">
|
||||
@yield('css')
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}" defer></script>
|
||||
@yield('js')
|
||||
<script>
|
||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.classList.remove('light')
|
||||
document.documentElement.classList.add('dark')
|
||||
}
|
||||
</script>
|
||||
|
||||
@routes
|
||||
<script src="{{ mix('js/app.js') }}" integrity="{{ env('INTEGRITY_HASH_APP_JS') }}" defer></script>
|
||||
@inertiaHead
|
||||
|
||||
</head>
|
||||
<body class="font-sans antialiased">
|
||||
<div id="app" class="min-h-screen bg-slate-50">
|
||||
@yield('body')
|
||||
@inertia
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
<snippet>
|
||||
<content><![CDATA[
|
||||
<div class="">
|
||||
<label for="${1:foo}">${2:Foo}</label>
|
||||
<input type="${3:text}" id="${1:foo}" name="${1:foo}" value="" placeholder="${4:placeholder text}">
|
||||
<div class="grid auto-rows-max gap-y-0">
|
||||
<label for="${1:foo}" class="">${2:Foo}</label>
|
||||
<input type="${3:text}" id="${1:foo}" name="${1:foo}" value="" class="" placeholder="${4:placeholder text}">
|
||||
<p>Input error</p>
|
||||
</div>
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
|
@ -68,7 +68,7 @@
|
||||
<!-- -->
|
||||
</head>
|
||||
<body class="font-sans antialiased">
|
||||
<div id="app" class="min-h-screen bg-slate-50">
|
||||
<div id="app" class="min-h-screen bg-neutral-100">
|
||||
<!-- -->
|
||||
</div>
|
||||
</body>
|
||||
|
@ -1,14 +1,15 @@
|
||||
<snippet>
|
||||
<content><![CDATA[
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\${1:MODEL};
|
||||
use Inertia\Inertia;
|
||||
|
||||
public function index()
|
||||
public function index(Request \$request)
|
||||
{
|
||||
\$data = [
|
||||
'${2:models}' => ${1:MODEL}::where('user_id', Auth::id())->paginate(),
|
||||
'${2:models}' => ${1:MODEL}::where('user_id', \$request->user()->id)->paginate(),
|
||||
];
|
||||
|
||||
return view('${2:models}.index')->with(\$data);
|
||||
return Inertia::render('${2:models}/Index')->with(\$data);
|
||||
}
|
||||
|
||||
public function show(${1:MODEL} \$${3:model})
|
||||
@ -17,14 +18,14 @@ public function show(${1:MODEL} \$${3:model})
|
||||
'${3:model}' => \$${3:model},
|
||||
];
|
||||
|
||||
return view('${2:models}.show')->with(\$data);
|
||||
return Inertia::render('${2:models}/Show')->with(\$data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
\$data = [];
|
||||
|
||||
return view('${2:models}.create')->with(\$data);
|
||||
return Inertia::render('${2:models}/Create')->with(\$data);
|
||||
}
|
||||
|
||||
public function store(Request \$request)
|
||||
@ -33,21 +34,21 @@ public function store(Request \$request)
|
||||
// assign model fields
|
||||
|
||||
if (\$${3:model}->save()) {
|
||||
\$request->session()->flash('status', "Successfully added {\$${3:model}->${4:field}}.");
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'success', 'banner' => "Successfully added {\$${3:model}->${4:field}}."]);
|
||||
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully added {\$${3:model}->${4:field}}.");
|
||||
}
|
||||
|
||||
\$request->session()->flash('error', 'Unable to save that ${3:model}.');
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'danger', 'banner' => "Unable to save that ${3:model}."]);
|
||||
return redirect()->back()->with('error', 'Unable to save that ${3:model}.');
|
||||
}
|
||||
|
||||
public function edit(${1:MODEL} \$${3:model})
|
||||
public function edit(Request \$request, ${1:MODEL} \$${3:model})
|
||||
{
|
||||
\$data = [
|
||||
'${3:model}' => \$${3:model},
|
||||
];
|
||||
|
||||
return view('${2:models}.edit')->with(\$data);
|
||||
return Inertia::render('${2:models}/Edit')->with(\$data);
|
||||
}
|
||||
|
||||
public function update(Request \$request, ${1:MODEL} \$${3:model})
|
||||
@ -55,11 +56,11 @@ public function update(Request \$request, ${1:MODEL} \$${3:model})
|
||||
// assign model fields
|
||||
|
||||
if (\$${3:model}->update()) {
|
||||
\$request->session()->flash('status', "Successfully updated {\$${3:model}->${4:field}}.");
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'success', 'banner' => "Successfully updated {\$${3:model}->${4:field}}."]);
|
||||
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully updated {\$${3:model}->${4:field}}.");
|
||||
}
|
||||
|
||||
\$request->session()->flash('error', "Unable to update {\$${3:model}->${4:field}}.");
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'danger', 'banner' => "Unable to update ${3:model}."]);
|
||||
return redirect()->back()->with('error', "Unable to update {\$${3:model}->${4:field}}.");
|
||||
}
|
||||
|
||||
@ -67,11 +68,11 @@ public function destroy(Request \$request, ${1:MODEL} \$${3:model})
|
||||
{
|
||||
\$${4:field} = \$${3:model}->${4:field};
|
||||
if (\$${3:model}->delete()) {
|
||||
\$request->session()->flash('status', "Successfully removed {\$${4:field}}.");
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'success', 'banner' => "Successfully removed {\$${4:field}}."]);
|
||||
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully removed {\$${4:field}}.");
|
||||
}
|
||||
|
||||
\$request->session()->flash('error', "Unable to remove {\$${4:field}}.");
|
||||
\$request->session()->flash('flash', ['bannerStyle' => 'danger', 'banner' => "Unable to remove {\$${4:field}}."]);
|
||||
return redirect()->back()->with('error', "Unable to remove {\$${4:field}}.");
|
||||
}
|
||||
]]></content>
|
||||
|
@ -1,20 +1,25 @@
|
||||
<snippet>
|
||||
<content><![CDATA[
|
||||
Route::get('/${1:route}', [${3:controller}Controller::class, 'index'])->name('dashboard.${1:route}.index');
|
||||
Route::get('/${1:route}/create', [${3:controller}Controller::class, 'create'])->name('dashboard.${1:route}.create');
|
||||
Route::post('/${1:route}', [${3:controller}Controller::class, 'store'])->name('dashboard.${1:route}.store');
|
||||
Route::get('/${1:route}/{${2:model}}', [${3:controller}Controller::class, 'show'])
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.show');
|
||||
Route::get('/${1:route}/{${2:model}}/edit', [${3:controller}Controller::class, 'edit'])
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.edit');
|
||||
Route::post('/${1:route}/{${2:model}}', [${3:controller}Controller::class, 'update'])
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.update');
|
||||
Route::delete('/${1:route}/{${2:model}}', [${3:controller}Controller::class, 'destroy'])
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.destroy');
|
||||
Route::controller(${3:controller}Controller::class)->group(function () {
|
||||
Route::get('/${1:route}', 'index')
|
||||
->name('dashboard.${1:route}.index');
|
||||
Route::get('/${1:route}/create', 'create')
|
||||
->name('dashboard.${1:route}.create');
|
||||
Route::post('/${1:route}', 'store')
|
||||
->name('dashboard.${1:route}.store');
|
||||
Route::get('/${1:route}/{${2:model}}', 'show')
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.show');
|
||||
Route::get('/${1:route}/{${2:model}}/edit', 'edit')
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.edit');
|
||||
Route::post('/${1:route}/{${2:model}}', 'update')
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.update');
|
||||
Route::delete('/${1:route}/{${2:model}}', 'destroy')
|
||||
->where('${2:model}', '[0-9]+')
|
||||
->name('dashboard.${1:route}.destroy');
|
||||
});
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<tabTrigger>lararoutes</tabTrigger>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<content><![CDATA[
|
||||
<script setup>
|
||||
import { useAttrs, reactive, ref, computed, watch, onBeforeMount, onMounted, provide, inject } from 'vue'
|
||||
import { useForm, usePage } from '@inertiajs/inertia-vue3'
|
||||
import AppLayout from '@/Layouts/AppLayout.vue'
|
||||
|
||||
const emit = defineEmits([])
|
||||
|
Loading…
x
Reference in New Issue
Block a user