0 Best Reply Awards

  • Member Since 1 Year Ago
  • 20 Lessons Completed
  • 0 Favorites

16th July, 2018

SeroS left a reply on SortByDesc() Not Working As Intended • 5 days ago

Sorry for the late reply. The problem was in another part of the code, but your option it's much more cleaner, i'm still starting at this so my code is not as clean as i want it to be.

Thanks for all the help.

12th July, 2018

SeroS left a reply on SortByDesc() Not Working As Intended • 1 week ago

Thanks bobbybouwmann, seems like you code is better writed than mine, but the problem was that i made 2 errors.

  1. That the función `sacar_cc_final_client was returning a `strin and not a `floa, so that makes the sorting work strange.

  2. I was formating the number on the controller and not in the view, so that makes my code really messy and hard to check for errors.

Thanks for the help.

11th July, 2018

SeroS started a new conversation SortByDesc() Not Working As Intended • 1 week ago

I have this 2 functions, the problem is that when i use the función sortByDesc, the new collection $clientes is not sorted as it should, if you need more info just ask me, thanks in advance.

      $clientes = cliente::select('id','nombre','codigo_empresa','condiciones_pago')->get();

      foreach ($clientes as $cliente) {
        // $cliente->cc_al_dia = number_format( sacar_cc_al_dia_cliente($cliente->id,carbon::now()) , 2 );

        $cliente->cc_final = $this->sacar_cc_final_cliente($cliente->id);

      $clientes = $clientes->sortByDesc('cc_final');

      return view('estadisticas.estado_cc_clientes',compact('clientes'));
public function sacar_cc_final_cliente($cliente_id){
      $cc_debe = cc_clientes::where('cliente_id',$cliente_id)->whereIn('tipo_de_documento',['fc','nd'])->where('borrado',0)->sum('importe');

      $cc_haber = cc_clientes::where('cliente_id',$cliente_id)->whereIn('tipo_de_documento',['rc','nc'])->where('borrado',0)->sum('importe');

      $cc_final = $cc_debe - $cc_haber;

      $cc_final = number_format($cc_final,2);

      return $cc_final;

23rd April, 2018

SeroS left a reply on Use $request After Reload A Page • 2 months ago

Thanks to all, i found a "solution" it work but i don't know if it's the more elegant way to do it, what i do it's that my select have onchange="myFunction()".

i have this on my view

<form id="form" method="POST" action="/insumos/insumos/{{$request->id}}/update">
    <div class="row">
        <div class="col-md-12">
            <button  id="boton_submit" type="submit" class="btn btn-primary form-control">Modificar</button>


    function myFunction() {
        document.getElementById("form").method = "get";
        document.getElementById("form").action = "/insumos/insumos/{{$request->id}}/edit";


And on the controller i use the $request, to check for the changes; and know what changes should i made to the html.

22nd April, 2018

SeroS left a reply on Use $request After Reload A Page • 3 months ago

The thing is, i have a page with a select and a input, and some other html that change based on the value of the select.

So what i want to use, is when the value of the select change, i reload the view with the html changed, but the problem is, if the user have already filled the input i would like to get that value and use it to refill the input again in the new page.

Thanks in advance

SeroS started a new conversation Use $request After Reload A Page • 3 months ago

Hello, i want to the know if there is a way to use the $request on the controller after i use this js function.


Or should i use another function to reload the page and be able to use the $request from the controller.

5th April, 2018

SeroS left a reply on HttpException In Handler.php Line 115: This Action Is Unauthorized • 3 months ago

It still not working, i changed the code to what you said, i updated the first post to show how the code it is at this moment. The problem is that ProveedorPolicy don't get called, but i can't get why.

SeroS left a reply on HttpException In Handler.php Line 115: This Action Is Unauthorized • 3 months ago

Thanks bobbybouwmann, i already tryed that but i get the same error.

4th April, 2018

SeroS started a new conversation HttpException In Handler.php Line 115: This Action Is Unauthorized • 3 months ago

I get this error when larval reach ```$this->authorize('Index', Proveedor::class); Thanks in advance i traed a lot of changes and i don't get why i get this error.

Here is the Code for the controller.

       $this->authorize('Index', Proveedor::class);

The Code of ProveedorPolicy


namespace App\Policies;

use App\User;
use App\Proveedor;
use Illuminate\Auth\Access\HandlesAuthorization;

class ProveedorPolicy
   use HandlesAuthorization;
    * Determine if the given user can create posts.
    * @param  \App\User  $user
    * @return bool
   public function Index(User $user)
       dd("entro a la POLICY!!!!!!");
       return true;

The code of AuthServiceProvider


namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
    * The policy mappings for the application.
    * @var array
   protected $policies = [
       'App\Model' => 'App\Policies\ModelPolicy',

       Proveedor::class => ProveedorPolicy::class, //este lo agregue yo


    * Register any authentication / authorization services.
    * @return void
   public function boot()

       Gate::define('posts.view', '[email protected]');
       Gate::define('proveedor.index', '[email protected]');

29th November, 2017

SeroS left a reply on $ Inside An @if • 7 months ago

Thanks to both it worked perfecty after switching " with ' .

28th November, 2017

SeroS started a new conversation $ Inside An @if • 7 months ago

i have this code but laravel is thinking that $S is a variable when it should be a string to be compared with old('moneda'), what i'm doing wrong?.

@if ( old('moneda') == "U$S" )
                        <option value="AR$">AR$</option>
                        <option value="U$S" select="selected">U$S</option>

17th February, 2017

SeroS started a new conversation Dynamic Table Based On Dropdown Selection • 1 year ago

Hello, i have a table on a database with the fields "first_name" and "last_name",and on the my view i have a dropdown populated with the last names on the database, what i want is to show a list on my view with the content of the database, but if i select a last name on the dropdown, i want that my list change dynamicaly and only show the people that have that last name i choosed on the dropdown. Anyone can point me where can i start looking how to make it, i dont know exactly how to search it. Thanks in advance

4th February, 2017

SeroS left a reply on Cascading Dropdown List • 1 year ago

I know that the HTML code goes in my view, but where should i put the

''' $("#series").chained("#mark"); '''

and the



SeroS started a new conversation Cascading Dropdown List • 1 year ago

I have 2 tables one called "proveedores" and another one called "clientes"; both tables have the same field called "nombre". I want to populate the second dropdown list with all the ítem on the field "nombre" of the database that the user choose on the first dropdownlist, can you help me, cause i'm new at this and i know that i have to use a java script or something like it. thanks in advance.

Here is what i have on the form.blade.php


{!! Form::label('tipo_empresa','Tipo de Empresa: ') !!} {!! Form::select('tipo_empresa', array('Cliente' => 'Cliente', 'Proveedor' => 'Proveedor'), null, ['class'=>'form-control'] ) !!} {!! Form::label('nombre','Nombre de la empresa: ') !!} {!! Form::text('nombre',null,['class'=>'form-control']) !!} '''

here is the controller

''' public function create() {

  return view('contactos.create');

public function store(contactorequest $request)

    'user_id'=> Auth::user()->id,
    'tipo_empresa'=> request('tipo_empresa'),
    'empresa_id'=> request('empresa_id'),
    'nombre'=> request('nombre'),
    'sector'=> request('secotr'),
    'telefono'=> request('telefono'),
    'interno'=> request('interno'),
    'mail'=> request('mail'),
    'celular'=> request('celular'),
    'localidad'=> request('localidad'),
    'observaciones'=> request('observaciones'),

  session()->flash('message','Contactos creado exitosamene');

  return redirect('contactos');



Edit Your Profile

Want to change your profile photo? We pull from