コード例 #1
0
 public function enviarCotizacion($contacto, $orden_compra)
 {
     $orden_compra = OrdenCompra::with('lineas')->find($orden_compra);
     $contacto = Contacto::with('proveedor')->find($contacto);
     $cotizacion = Cotizacion::create(['id_ordencompra' => $orden_compra->id, 'id_contacto' => $contacto->id, 'fecha_envio' => date('Y-m-d H:i:s'), 'moneda' => 'USD', 'estado' => 'E']);
     // Update token
     $token = bin2hex($cotizacion->id . '.' . $contacto->id . '.' . $orden_compra->id . '.' . date('Y-m-d'));
     $cotizacion->update(['token' => $token]);
     foreach ($orden_compra->lineas as $linea) {
         CotizacionLinea::create(['id_cotizacion' => $cotizacion->id, 'id_ordencompra_linea' => $linea->id, 'cantidad' => $linea->cantidad, 'valor' => 0]);
     }
     $cotizacion = Cotizacion::with('contacto.proveedor')->find($cotizacion->id);
     $this->enviarMailCotizacion($cotizacion);
 }
コード例 #2
0
ファイル: ContactoController.php プロジェクト: elcuy/Novopan
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $record = Contacto::find($id)->delete();
     return new AjaxResponse('success', '');
 }