Laravel, inertiajs e vue3 - Comandos
Autor: Eurai Criado: 13/02/2024 Atualizado: 20/02/2024Salve salve, blz??
Forçar erro no campo do form.errors.
No laravel
throw ValidationException::withMessages(['nome do campo no form' => ['XXX']]);
throw ValidationException::withMessages(['quantity' => ['XXX']]);
//No controller
Spin, no app.js
progress: {
delay: 250,
color: 'red',
includeCSS: true,
showSpinner: true,
},
Pegar o index do select no event change
oProps.oFieldsOpt[oEvent.target.selectedIndex].type
oEvent.target.selectedIndex
const fChangeSearch = (oEvent, nIndex) => {
oBox.value = oProps.oFieldsOpt[oEvent.target.selectedIndex].cbox;
}
Props atualizados, envio de mensagens.
public function share(Request $request): array
{
// dd(...parent::share($request));
return [
...parent::share($request),
'auth' => [
'user' => $request->user(),
],
'flash' => [
'success' => fn () => $request->session()->get('success'),
'info' => fn () => $request->session()->get('info')
],
'date_updated' => date('Y-m-d H:i:s'),
'APP_URL' => env('APP_URL'),
];
}
<div v-show="page.props.flash.success">
<AlertSuccess :cMessage="page.props.flash.success" :cChave="page.props.date_updated" />
div>
<div v-show="page.props.flash.info">
<AlertInfo :cMessage="page.props.flash.info" :cChave="page.props.date_updated" />
div>
Class condicional
:class="(nSeriesAllCXActual < 0 ? 'bg-red-400':'bg-green-400')"
Gostou? Compartilhe com seus amigos e deixe um comentário! 😎
Um abraço, e até a próxima