Tweaking many components after using them for a while

This commit is contained in:
2021-12-14 09:41:00 -07:00
parent 8916410167
commit 1c77ddde0b
7 changed files with 54 additions and 38 deletions

View File

@ -1,9 +1,11 @@
<snippet>
<content><![CDATA[
use Illuminate\Support\Facades\Auth;
public function index()
{
\$data = [
'${2:models}' => ${1:MODEL}::where('user_id', auth()->id())->paginate(),
'${2:models}' => ${1:MODEL}::where('user_id', Auth::id())->paginate(),
];
return view('${2:models}.index')->with(\$data);
@ -31,10 +33,10 @@ public function store(Request \$request)
// assign model fields
if (\$${3:model}->save()) {
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully added {\$${3:model}->${4:field}} as a ${3:model}.");
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully added {\$${3:model}->${4:field}}.");
}
return redirect()->back()->with('error', 'Unable to save that ${3:model}. Check the error logs.');
return redirect()->back()->with('error', 'Unable to save that ${3:model}.');
}
public function edit(${1:MODEL} \$${3:model})
@ -54,7 +56,7 @@ public function update(Request \$request, ${1:MODEL} \$${3:model})
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully updated {\$${3:model}->${4:field}}.");
}
return redirect()->back()->with('error', "Unable to update {\$${3:model}->${4:field}}. Check the error logs.");
return redirect()->back()->with('error', "Unable to update {\$${3:model}->${4:field}}.");
}
public function destroy(${1:MODEL} \$${3:model})
@ -64,7 +66,7 @@ public function destroy(${1:MODEL} \$${3:model})
return redirect()->route('dashboard.${2:models}.index')->with('status', "Successfully removed {\$${4:field}}.");
}
return redirect()->back()->with('error', "Unable to remove {\$${4:field}}. Check the error logs.");
return redirect()->back()->with('error', "Unable to remove {\$${4:field}}.");
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->