daniel21gt

daniel21gt

Member Since 5 Months Ago

Experience Points 3,700
Experience Level 1

1,300 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

17 Mar
1 day ago

daniel21gt started a new conversation Problem With Infinite Select, In Laravel 5.5

How about, I have tried to make an infinite select with scroll, since currently the select that I have loads indefinitely many records, but in the end it will be uncomfortable to see such a large list, which is why I want a scroll in the select that loads everything what's in that field of the bd, this is what I have.

<table style="width:100%;" border="0">
    <tr>
        <td style="width:100%;" border="0">

            <select name="tipo" id="tipo" class=" form-control" value="{{ old('tipo') }}" required style="width:150px">
                @foreach($usuariosOpciones as $user_id => $usuario_ad)
                <option value="{{$user_id}}">{{ $usuario_ad }}</option>
                @endforeach
            </select>
        </td>

        <td style="width:50%;" border="1">
            <button type="submit" class="btn btn-primary">enviar</button>
        </td>
    </tr>
</table>

This is my controller.

public function selector(Request $request)

    {   

        $registrado = \Auth::user()->tipos_usuarios_id;
        $filtro = \Auth::user()->username;
        $filid = \Auth::user()->id;

      if($registrado == 1)

      {
        $request->user()->authorizeRoles(['admin']);
        $usuarios=usuarios::where("user_id", $request->tipo)->paginate(10);
        $usuarios->appends(['tipo'=> $request->tipo]);
        $usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
        $conteo=usuarios::where('user_id', $request->tipo)->count();
        return view('usuario.index')->with(["usuarios" => $usuarios, "usuariosOpciones" => $usuariosOpciones, "conteo" => $conteo]);
       }

}

I know there are several ways to do it with ajax or jquery for example, but I'm new to these languages, I still do not understand the logic to implement it in what I have, and thus achieve a simple scroll select.

07 Mar
1 week ago

daniel21gt started a new conversation Problem With Query Insert Into, Laravel 5.5

I have the following code.

$this->validate($request,['user_id', 'gobe_id'=>'required', 'alcal_id'=>'required', 'conse_id'=>'required', 'asam_id'=>'required', 'nombre'=>'required', 'apellido'=>'required', 'cedula'=>'required|max:11|unique:usuarios', 'telefonos'=>'required','direccion'=>'required', 'barrio'=>'required', 'lugar_votacion'=>'required', 'mesa_votacion'=>'required', 'email'=>'required|unique:usuarios', 'ciudad'=>'required', 'estado']);

              usuarios::create($request->all());

When I enter this ID number 4521511210

I get this error

"SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'cedula' at row 1 (SQL: insert into usuarios (user_id, usuario_ad, nombre, apellido, telefonos, cedula, barrio, lugar_votacion, mesa_votacion, email, ciudad, direccion, gobe_id, alcal_id, conse_id, asam_id, updated_at, created_at) values (3, danielad, velentina, sarmiento, 5142621, 4521511210, cuba, cuba, 32, [email protected], Dosquebradas, cra 12 45 65, 3, 3, 1, 1, 2019-03-08 02:30:44, 2019-03-08 02:30:44))

05 Mar
1 week ago

daniel21gt left a reply on What Are The Ways To Compare NULL Values? In Laravel 5.5

I understand cronix, I just thought maybe there could be another way, but if you say that's fine, then I can rest assured, thank you for your opinion.

daniel21gt started a new conversation What Are The Ways To Compare NULL Values? In Laravel 5.5

How about, I have the following query comparing a NULL value, I do not think it is the most appropriate way, is there a more technical way to compare a null column?

usuarios::where('asignacion', NULL)->where('cedula', $request->cedula)->update(['asignacion' => $gestionUnicos->last()]);

02 Mar
2 weeks ago

daniel21gt left a reply on Doubt With Implementation Of Dynamic Select In Laravel 5.5

No, dependent, no, I just need a select but infinite

daniel21gt started a new conversation Doubt With Implementation Of Dynamic Select In Laravel 5.5

Can someone advise me, where can I investigate to create an infinite and dynamic select?

24 Feb
3 weeks ago

daniel21gt left a reply on Configuring Redirection In Laravel 5.5

Thanks jlrdw, that's a very recursive idea, it will do

daniel21gt left a reply on Configuring Redirection In Laravel 5.5

Is there any file that you can see 419.blade.php, to redirect it to login?

daniel21gt started a new conversation Configuring Redirection In Laravel 5.5

so, today I tried to perform a redirect, I pretend that when the session time expires, I automatically redirected to the login path, and not to this path (\ vendor \ laravel \ framework \ src \ Illuminate \ Foundation \ Exceptions \ views \ 419.blade.php

I have done this in the handler, but it does not work, it keeps getting there.

* @param  \Exception  $exception
 * @return void
 */
public function report(Exception $exception)
{
    parent::report($exception);
}

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $exception
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $exception)
{
    
      if($this->isHttpException($exception))
    {
        switch ($exception->getStatusCode()) {
            //access denied
            case 401:
                return response()->view('usuario.error', [], 401);  
            break;
            // not found
            case 404:
                return response()->view('usuario.error', [], 404);
            break;
            // internal error
            case 403:
                return response()->view('usuario.error', [], 403);  
            break;
            // internal error
            case 500:
                return response()->view('usuario.error', [], 500);  
            break;
              // internal error
            case 405:
                return redirect()->route('login');
            break;
            // internal error
            case 419:
                return redirect()->route('login');
            break;

            default:
                return $this->renderHttpException($exception);
            break;
        }
    }
    else
    {
        return parent::render($request, $exception);
    }

}

What can I do to achieve this?

14 Feb
1 month ago

daniel21gt started a new conversation Problem When Selecting Laravel 5.5 Columns

How about, I have the following query, in eloquen.

$conteoconsejales = usuarios::join('advice', 'usuarios.conse_id', '=' , 'advice.ida')->where('conse_id',$valorconse)->where('asignacion', '<>', '')->select('user_id', 'usuario_ad')->get();

The problem is that I have a column from another table, called advice, but I want to include it within the -> select (), but I do not know if this can be done?

01 Feb
1 month ago

daniel21gt left a reply on Problems With Select When Sending Data By POST. Laravel 5.5

I found the error, it was necessary to add the id field in the query.

$governor=governor::select('id','governor_candidate')->orderByRaw("FIELD(id, $gobernadorf) DESC")->get();

daniel21gt started a new conversation Problems With Select When Sending Data By POST. Laravel 5.5

I have the following html code, my problem is that in the end I have 4 select, which work well, I extract correct information.

https://paste.laravel.io/01a2ce91-4dc2-4160-b746-b6af50cd42b9

The problem is when I send this by POST to the update driver, since I have this error.

"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'gobe_id' cannot be null (SQL: update usuarios set gobe_id = , alcal_id = , conse_id = , `a ▶"

I do not understand why, in actuality, the select ones have records, but when sending them, they do not send anything, why could this happen?

daniel21gt started a new conversation Tittle

test

hello

31 Jan
1 month ago

daniel21gt left a reply on Problems With Query Translation Sql To Eloquent, Laravel 5.5

Thank very muchs jlrdw, this is the solutions

governor::select('governor_candidate') ->orderByRaw("FIELD(id, 3) DESC") ->get();

daniel21gt left a reply on Problems With Query Translation Sql To Eloquent, Laravel 5.5

It is a select, when I return the form I want it to show me the values that are already saved by each user, and not that the same select me for all, now, yes, I must see many tutorials, I still do not have an experience like yours

daniel21gt left a reply on Problems With Query Translation Sql To Eloquent, Laravel 5.5

Yes, but a value appears, I explain, in the table I have 4 records, what I'm looking for is that when I change the id I show that as the first value, and then the others.

daniel21gt left a reply on Problems With Query Translation Sql To Eloquent, Laravel 5.5

I understand, but what can I do, if I need the id field to be able to change a value?

daniel21gt started a new conversation Problems With Query Translation Sql To Eloquent, Laravel 5.5

I try to translate this query

select governor_candidate from governor order by governor.id=3 desc;

not work

governor::orderBy ('id=3', 'DESC');

What I'm I missing of?

daniel21gt started a new conversation Problems When Clearing Cache In Laravel 5.5

How about, I made some changes in a view, but these are not reflected, I applied the following commands

php artisan route:clear php artisan cache:clear php artisan view:clear php artisan config:cache

I have deleted the browser history and I have restarted it, but still I do not apply the changes.

It's the first time this happens to me, is it possible to fix it?

30 Jan
1 month ago

daniel21gt left a reply on How To Leave A Value Already Chosen By A Select, Laravel 5.5

I see, this is why

Candidatos gobernador

Gracias Sergiu17

daniel21gt left a reply on How To Leave A Value Already Chosen By A Select, Laravel 5.5

thanks sergiu17, I have tried your suggestion, but still does not retain the value, missing some detail?

daniel21gt started a new conversation How To Leave A Value Already Chosen By A Select, Laravel 5.5

How about, I have a small problem, currently in a simple input field, I have this variable that helps the chosen value remain there, in case the form does not send anything to validate a required field, old ('address'), It works well.

The problem I have with a select, and if I apply old ('gobe_id'), it does not retain the value, this will be possible to do?

[code]

Candidatos gobernador @foreach($governor as $item) {{$item->governor_candidate}} @endforeach
                                    @if ($errors->has('gobe_id'))
                                         <span class="help-block">
                                        <strong>{{ $errors->first('gobe_id') }}</strong>
                                    </span>
                                  @endif  
                               </div>
                            </div>

[/code]

18 Jan
2 months ago

daniel21gt left a reply on Problem Session Expired In Login. Laravel 5.5

Gracias Snapey, Comprendo lo que dices

daniel21gt started a new conversation Problem Session Expired In Login. Laravel 5.5

How are you.

I have a project, that after starting the session, it expires after 15 minutes of inactivity, it works well. The problem is when I leave the login for more 15 minutes, http: //proyectodos.test/login When I login with username and password it tells me that time expires, so I have to update the page to be able to login.

Is there any way to exclude the expiration time to the main login path?

daniel21gt left a reply on Open Session When Closing Browser, Laravel 5.5

Well, sometimes there are careless people who close the browser and believe that their session too.

daniel21gt started a new conversation Open Session When Closing Browser, Laravel 5.5

How are you

What can I do so that when I close the browser, the session is closed, since it is currently open.

I have changed 'expire_on_close' => false, in true but it is still the same

17 Jan
2 months ago

daniel21gt left a reply on How Can I Get The Last Digit In The Url, Laravel 5.5

Thanks eparcel_fi, as I did it works, but as you do it is much more professional, I have a lot to learn.

daniel21gt left a reply on How Can I Get The Last Digit In The Url, Laravel 5.5

Cronix, so I will always get the last number regardless of the number of digits, again thanks for your help.

$valor = request()->headers->get('referer'); $str = $valor; parse_str($str, $output); dd($output['http://proyectodos_test/panel/selectord?valorusuario'][0]);

16 Jan
2 months ago

daniel21gt left a reply on How Can I Get The Last Digit In The Url, Laravel 5.5

I understand perfectly, thank you very much cronix, as always with the correct answer ..

daniel21gt started a new conversation How Can I Get The Last Digit In The Url, Laravel 5.5

How about, I have the following line

dd(request()->headers->get('referer'));

which shows me this

"http://proyectodos.test/panel/selectord?valorusuario=3"

I have no idea if I am possible, but I want to extract the last digit, the number 3, can I?

daniel21gt left a reply on Problems With Paginate (), Do Not Load All Lists In Laravel 5.5

Thank you very much Vilfago, now I understand.

daniel21gt left a reply on Problems With Paginate (), Do Not Load All Lists In Laravel 5.5

Or if it worked perfect, why did not work with post?

daniel21gt left a reply on Problems With Paginate (), Do Not Load All Lists In Laravel 5.5

I'm using the post method, look

{{csrf_field()}} Pendiente Descartado Confirmado enviar

and route

Route::post('/panel/bestado', '[email protected]')->name('usuario.bestado');

daniel21gt started a new conversation Problems With Paginate (), Do Not Load All Lists In Laravel 5.5

I have a problem with the page, since in my case it shows two pages, the first one loads well, but when I click on page 2 it throws me an error 405, which could be wrong in my method?

public function bestado(Request $request) {

    $registrado = \Auth::user()->tipos_usuarios_id;
    $filtro = \Auth::user()->username;

    if($registrado == 1)

    { 
        $request->user()->authorizeRoles(['admin']);
        $valorestado = $request->valorestado;
        $consultarea=usuarios::where('estado', $valorestado)->paginate(6);
        $consultarea->appends(['valorestado'=>$valorestado]);
        $usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
        $conteo=usuarios::where('estado', $valorestado)->count();
        return view('usuario.consultareas')->with(["consultarea" => $consultarea, "usuariosOpciones" => $usuariosOpciones, "conteo" => $conteo]);
       
    }

}

15 Jan
2 months ago

daniel21gt left a reply on Undefined Variable Error Laravel 5.5

realrandyallen thank you very much, then had to inherit the variable to these functions, it is the first time that happens to me, now it works, thanks to others for their attention.

daniel21gt left a reply on Undefined Variable Error Laravel 5.5

the 1 is Administrator and the 3 is a limited user of Gestion, with which I have problem is the one of Gestion

daniel21gt left a reply on Undefined Variable Error Laravel 5.5

It's this snapey

$conteoestados = usuarios::whereNotNull('asignacion')->where('asignacion', $filtros)->get();

If I put dd ($filtros) after this line, it goes without problems

$request->user()->authorizeRoles(['gestion']);

but if I put dd ($filtros) after this line I have variable problems not defined

$excelestados->sheet('Excelsheet', function($sheet) {

daniel21gt started a new conversation Undefined Variable Error Laravel 5.5

I have an undefined variable error, which in fact if it is defined, it is called $filtro, the code is this.

public function excelestados(Request $request)
{        
   
   $registrado = \Auth::user()->tipos_usuarios_id;
   $filtros = \Auth::user()->username;

   if($registrado == 1)

    {
        $request->user()->authorizeRoles(['admin']);

        Excel::create('ExcelEstados', function($excelestados) {
        $excelestados->sheet('Excelsheet', function($sheet) {
         

          $conteoestados = usuarios::whereNotNull('asignacion')->get();

              $conteoestados = json_decode( json_encode($conteoestados), true);

              $sheet->fromArray($conteoestados);
              $sheet->setOrientation('landscape');
          
        });

    })->export('xls');
   
   }


  if($registrado == 3)
   
    {

        $request->user()->authorizeRoles(['gestion']);
        
        Excel::create('ExcelEstados', function($excelestados) {
        $excelestados->sheet('Excelsheet', function($sheet) {
         

          $conteoestados = usuarios::whereNotNull('asignacion')->where('asignacion', $filtros)->get();

              $conteoestados = json_decode( json_encode($conteoestados), true);

              $sheet->fromArray($conteoestados);
              $sheet->setOrientation('landscape');
          
        });

    })->export('xls');

  }

}

If I enter as admin, I enter well, but as a manager I get this error, I already checked that the variable $filtro really had value, but even so I get that error.

13 Jan
2 months ago
10 Jan
2 months ago

daniel21gt started a new conversation Doubt Works With {{csrf_field ()}}, In Laravel 5.5

How about, does anyone know how I can verify if the {{csrf_field ()}} works correctly in my forms?

08 Jan
2 months ago

daniel21gt started a new conversation Translation Problem To Eloquen

I have made a query with the DB :: table constructor, but I would like to pass it to eloquen, I still can not, someone knows how to translate this to eloquen?

public function excel()
{        
   
    Excel::create('LaravelExcel', function($excel) {
        $excel->sheet('Excelsheet', function($sheet) {
         
      $conteo = DB::table('usuarios')
          ->join('users', 'usuarios.user_id', '=', 'users.id')
          ->select('usuario_ad', 'name', 'last_name', 'tipos_usuarios_id', DB::raw('count(nombre) as nombre'))
          ->groupBy(['usuario_ad', 'name', 'last_name', 'tipos_usuarios_id'])
          ->orderBy('nombre', 'desc')
          ->get();

            $sheet->fromArray($conteo);
            $sheet->setOrientation('landscape');
        });
    })->export('xls');
}
02 Jan
2 months ago

daniel21gt left a reply on Problems With Exceptions

Thank you very much cronix, I found a way to exclude the show method as well. Route :: resource ('/ panel / ecuentas', 'AccountController') -> except (['show']); I returned an error 405, and now if I am working the message that I had already configured. As always, your comments are correct.

daniel21gt started a new conversation Problems With Exceptions

[php]

*/ public function render($request, Exception $exception) {

      if($this->isHttpException($exception))
    {
        switch ($exception->getStatusCode()) {
            //access denied
            case 401:
                return response()->view('usuario.error', [], 401);  
            break;
            // not found
            case 404:
                return response()->view('usuario.error', [], 404);
            break;
            // internal error
            case 403:
                return response()->view('usuario.error', [], 403);  
            break;
            // internal error
            case 500:
                return response()->view('usuario.error', [], 500);  
            break;

            default:
                return $this->renderHttpException($exception);
            break;
        }
    }
    else
    {
        return parent::render($request, $exception);
    }

[php]

22 Dec
2 months ago

daniel21gt left a reply on Protecting Ids In Queries.

If I had known that I had to start from there I would not have asked, perhaps you have never been in a situation where you do not know where to start ?, I only consult for advice to help me locate or to make fun of my

daniel21gt started a new conversation Protecting Ids In Queries.

How are you.

I have encountered a problem in one of my urls when I edit information, as this appears to me.

https://strol.test/panel/cuentaeditar/10

I am a newbie in the issue of permissions, since I manage to register modules to users, but I do not know how to apply security rules to the eloquen query, to avoid looking for information from the url, how can I avoid this?

This is my metod

public function cuentaeditar(Request $request, $id) { $request->user()->authorizeRoles(['admin','referido','gestion']); $user=user::find($id); return view('usuario.editcuenta',compact('user')); }

and my route.

Route::post('/panel/cuentaeditar/{id}', '[email protected]')->name('cuenta.cuentaeditar');

18 Dec
3 months ago

daniel21gt left a reply on Problem Query Eloquent

Thanks douglasakula, this is solution.

public function reportes(Request $request) { $request->user()->authorizeRoles(['admin']);

    $conteo = DB::table('usuarios')
          ->join('users', 'usuarios.user_id', '=', 'users.id')
          ->select('usuario_ad', 'name', 'last_name', 'tipos_usuarios_id', DB::raw('count(nombre) as nombre'))
          ->groupBy(['usuario_ad', 'name', 'last_name', 'tipos_usuarios_id'])
          ->orderBy('nombre', 'desc')
          ->paginate(10);

    return view('usuario.reportes',compact('conteo'));

    
 }