daniel21gt

daniel21gt

Member Since 4 Months Ago

Experience Points 3,400
Experience Level 1

1,600 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.

14 Feb
4 days 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
2 weeks 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
2 weeks 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
2 weeks 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
1 month 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
1 month 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
1 month 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
1 month 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
1 month ago
10 Jan
1 month 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
1 month 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
1 month 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
1 month 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
2 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'));

    
 }
17 Dec
2 months ago

daniel21gt started a new conversation Problem Query Eloquent

I have made this query in mysql, to consult two tables and it works well.

SELECT COUNT(nombre), usuario_ad, name, last_name FROM usuarios, users where usuario_ad=username GROUP BY usuario_ad;

A member of this forum helped me with one, but I can not find how to adapt it for two tables.

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

    $conteo = DB::table('usuarios')
          ->select('usuario_ad', DB::raw('count(nombre) as nombre'))
          ->groupBy('usuario_ad')
          ->orderBy('nombre', 'desc')
          ->paginate(10);

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

    
 }
16 Dec
2 months ago

daniel21gt left a reply on Problems With Translation Of Query To Eloquen

Yes regal2157, thanks very much

daniel21gt left a reply on How To Use A Foreach Inside A Controller?

I found an easier way to do it, it is with this query, but I do not know how to translate it to eloquen

SELECT COUNT(nombre), usuario_ad FROM usuarios GROUP BY usuario_ad ORDER BY COUNT(nombre) desc;

daniel21gt started a new conversation Problems With Translation Of Query To Eloquen

How about, I tried to translate this query sql to eloquen, but I do not achieve it, does anyone know how I can do it?

SELECT COUNT(nombre), usuario_ad FROM usuarios GROUP BY usuario_ad ORDER BY COUNT(nombre) desc;

13 Dec
2 months ago

daniel21gt started a new conversation How To Use A Foreach Inside A Controller?

Is there a way to count this query in a foreach within the controller?

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

    $reporuser=usuarios::pluck('usuario_ad', 'user_id')->unique();

      foreach($reporuser as $reporuse)

      {

        $conteo=usuarios::where('usuario_ad',$reporuse);

      }

    
}
27 Nov
2 months ago

daniel21gt left a reply on Foreign Value Problem In Seeder

thanks realrandyallen

daniel21gt left a reply on Foreign Value Problem In Seeder

Where do I read the rules of publication of Laracast?