SeroS

SeroS

Member Since 1 Year Ago

Experience Points 2,380
Experience
Level
Lessons Completed 20
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 Jul
4 months ago

SeroS left a reply on SortByDesc() Not Working As Intended

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.

12 Jul
5 months ago

SeroS left a reply on SortByDesc() Not Working As Intended

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.

11 Jul
5 months ago

SeroS started a new conversation SortByDesc() Not Working As Intended

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;
    }
23 Apr
7 months ago

SeroS left a reply on Use $request After Reload A Page

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">
    {{csrf_field()}}
    @include('insumos.view_categorias')
    <br/>
    @include('insumos.view_insumo_generico')
    <br/>
    @include('insumos.view_insumo')
    <br/>
    <div class="row">
        <div class="col-md-12">
            <button  id="boton_submit" type="submit" class="btn btn-primary form-control">Modificar</button>
        </div>
    </div>
</form>

<script>

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

</script>

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

22 Apr
7 months ago

SeroS left a reply on Use $request After Reload A Page

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

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

          location.reload();
    }

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

05 Apr
8 months ago

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

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

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

04 Apr
8 months ago

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

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

```<?php

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

```<?php

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()
   {
       $this->registerPolicies();


       Gate::define('posts.view', '[email protected]');
       Gate::define('proveedor.index', '[email protected]');
   }
}
29 Nov
1 year ago

SeroS left a reply on $ Inside An @if

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

28 Nov
1 year ago

SeroS started a new conversation $ Inside An @if

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>
@endif
17 Feb
1 year ago

SeroS started a new conversation Dynamic Table Based On Dropdown Selection

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

04 Feb
1 year ago

SeroS left a reply on Cascading Dropdown List

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

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)
{

  contacto::create([
    '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');

}

'''