public function client()
 {
     $all = $this->protocolRepository->all();
     $protocols = $this->protocolRepository->findByField('status', '1');
     $entries = $this->entryRepository->search();
     return view('layouts.client.index', compact('protocols', 'all', 'entries'));
 }
 public function change($id, $project_id)
 {
     $entry = $this->repository->find($id);
     $entry->project_id = $project_id;
     $entry->save();
     return redirect()->route('admin.layout.admin');
 }
 public function store($data, $entry_id)
 {
     \DB::beginTransaction();
     try {
         $free = $this->repository->create($data);
         $entry = $this->entryRepository->find($entry_id);
         $free->addEntry($entry);
         Session::put('success', 'Contato enviado com sucesso!');
         \DB::commit();
     } catch (\Exception $e) {
         \DB::rollback();
         throw $e;
     }
     Session::put('success', 'Contato enviado com sucesso!');
 }
 public function makeBank($id)
 {
     try {
         $entry = $this->entryRepository->find($id);
         $boleto = new BradescoBankings();
         $boleto->user_id = $entry->user->id;
         $boleto->entry_id = $id;
         $boleto->banking_id = $entry->project->banking->id;
         $boleto->dataVencimento = date("Y-m-d");
         $boleto->sacado = $entry->user->cpf;
         $boleto->sequencial = $entry->user->id;
         $boleto->save();
         $sacado = new Agente($entry->user->name, $entry->user->cpf, $entry->user->client->address . ' ' . $entry->user->client->complement . ' - ' . $entry->user->client->neighborhood, $entry->user->client->zipcode, $entry->user->client->city, $entry->user->client->state);
         $cedente = new Agente('Instituto de Seleção', '02.123.123/0001-11', 'Avenida Nossa Senhora da Penha 280 sala 205', '29055-340', 'Vitória', 'ES');
         $boleto = new Bradesco(array('dataVencimento' => new DateTime(date("Y-m-d", strtotime("+2 days"))), 'valor' => $entry->project->banking->valor, 'sequencial' => $entry->user->id, 'sacado' => $sacado, 'cedente' => $cedente, 'agencia' => $entry->project->banking->agencia, 'carteira' => $entry->project->banking->carteira, 'conta' => $entry->project->banking->conta, 'contaDv' => $entry->project->banking->contaDv, 'agenciaDv' => $entry->project->banking->agenciaDv, 'descricaoDemonstrativo' => array($entry->project->banking->descricaoDemonstrativo), 'instrucoes' => array($entry->project->banking->instrucoes)));
         return $boleto;
     } catch (\Exception $e) {
         throw $e;
     }
 }
 public function create($id, $entry_id)
 {
     $user = $this->repository->find($id);
     $entry = $this->entryRepository->find($entry_id);
     return view('clients.frees.create', compact('user', 'entry'));
 }
 public function dispatch($id)
 {
     $entry = $this->entryRepository->find($id);
     return view('client.entries.dispatch', compact('entry'));
 }