Good evening, I would like to put a warning type on the button if the user has made such a registration in my case has made a renewal, user enters the card and note that already made the subscription the name of the button changes and is written "inscribed". ..
--- Controller store that saves, and list data and sends the data to the form
public function listardados(){
$matricula = Matricula::where('user_id', Auth::id())->get();
//dd($matricula);
return view('dashboard.renovacao.teste', compact( 'matricula'));
}
public function store(RenovacaoRequest $request){
$user = Auth()->user();
$dados = $request->get('rematricula');
foreach ($dados as $key => $dado) {
Renovacao::create($dado);
}
return view('dashboard.renovacao.confirmacao', compact ('renovacao'));
}
- FORM
@extends('layouts.app') @section('content')
<div class="container">
<div class="row">
<form class="form-horizontal " id="regForm" action="{{route('renovacao.store')}}" method="POST">
<div class="card-panel white">
<h4 class="center">Solicitar Renovação</h4>
<div class="row"></div>
{{ csrf_field()}}
<div class="row">
@if($matricula->count())
<right>
<a>**Dados Cadastrados**</a>
</right>
<div class="row"></div>
<div class="row"></div>
@foreach($matricula as $matric)
<div class="row">
<div class="col s6 m6">
<div class="input-field {{$errors->has('') ? 'has-error' : ''}} ">
<label for="produto">Nome do Pai:</label>
<input type="text" class="form-control" name="rematricula[{{ $loop->index}}][nomerespo]" value="{{ $matric->nomedopai }}">
</div>
</div>
<div class="col s6 m6">
<div class="input-field {{$errors->has('') ? 'has-error' : ''}} ">
<label for="produto">Nome do Aluno(a):</label>
<input type="text" class="form-control" name="rematricula[{{ $loop->index}}][nomealuno]" value="{{ $matric->nomealuno }}">
</div>
</div>
</div>
@endforeach
<div class="col s12 m6">
<div class="row"></div>
<div class="row"></div>
<div class="row">
<div>
<div class="card-panel white ">
<b class="black-text">AVISO? </b></br></br>
<span>• Mensagem de Aviso </span></br></br>
</div>
</div>
</div>
<div class="row">
</div>
</div>
<div class = "row">
<div class="col s12">
<a title="Voltar Para Página Principal" class="btn orange darken-4 btn-info left " href="/admin">Voltar
<i class="material-icons left">arrow_back_ios</i>
</a>
<button type="submit" class="btn orange darken-4 btn-info right">Confirmar
<i class="material-icons left">save</i>
</button>
</div>
</div>
@else
<div class="row"></div>
<div class="row"></div>
<p> Desculpe! Página Indisponivel, Você não tem cadastro nessa instituição, Procure a secretaria e faça sua Matrícula </p>
<div class="row"></div>
<div class="row"></div>
<div class="row"></div>
<div class="row"></div>
<a title="Voltar Para Página Principal" class="btn orange darken-4 btn-info left " href="/admin">Voltar
<i class="material-icons left">arrow_back_ios</i>
</a>
@endif
</div>
</div>
</form>
</div>
@endsection