daniel21gt

Experience

930

0 Best Reply Awards

  • Member Since 3 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

15th October, 2018

daniel21gt left a reply on Problems With Data Query • 4 days ago

Thanks cronix.

daniel21gt left a reply on Problems With Data Query • 4 days ago

I have studied all your suggestions and I finally understood all my mistakes..

https://paste.laravel.io/2d92889b-39ab-4a39-bc57-980440516c5d

I was comparing the wrong field

And I was not calling the id = 'type' of the form, now the query filter works.

now the only thing I need is to adjust the method paginate ()

$usuarioshow=usuarios::where("user_id","=",$request->tipo)->paginate(10)->get();

Tengo este error

"Type error: Too few arguments to function Illuminate\Support\Collection::get(), 0 passed in C:\laragon\www\crudgobernaciontres\vendor\laravel\framework\src\Illuminate\Pagination\AbstractPaginator.php on line 577 and at least 1 expected ◀

13th October, 2018

daniel21gt left a reply on Problems With Data Query • 6 days ago

I want to consult all the users_ad unique in the database

My intension is

From the form send what I have in usuario_ad to this method in the controller

https://paste.laravel.io/c0e21cd2-f37d-43ff-aeaa-3f2a6d60c82a

the route for the show en route: list method is

GET|HEAD | panel/usuario/{usuario} | usuario.show | App\Http\Controllers\[email protected]

daniel21gt left a reply on Problems With Data Query • 6 days ago

It is correct cronix, now the view shows me all the records, but I also want to consult by usuario_ad, in the same view, is it possible to apply this filter in this same view?

https://ibb.co/iT83B9

daniel21gt left a reply on Problems With Data Query • 6 days ago

If there is cronix .. look $usuariosOpciones is in the index method,

Look at the entire files,

view complet: https://paste.laravel.io/ed0d4013-d4e0-4a4e-b342-0915ff953bc5

controller complet: https://paste.laravel.io/ae53372b-efca-4a7d-9a18-d15edb69dc3d

daniel21gt started a new conversation Problems With Data Query • 6 days ago

I want to check the records of any user that I select

view https://paste.laravel.io/bda1121e-ef9b-4a31-a6b0-4e675ad74424

And send the parameter to my controller

Controller https://paste.laravel.io/a6230ec2-1869-42cb-a822-42753dd518d5

But I get this error in the view "Undefined variable: usuario_ad (View: C:\laragon\www\crudgobernaciontres\resources\views\Usuario\index.blade.php)"

How I can avoid this?

daniel21gt left a reply on Doubt With Methods --resource • 6 days ago

As always cronix, successful, thanks

daniel21gt left a reply on Doubt With Methods --resource • 6 days ago

Where is it changed?

daniel21gt left a reply on Doubt With Methods --resource • 6 days ago

thank you

daniel21gt left a reply on Doubt With Methods --resource • 6 days ago

I understand, I was just confused because on top of the method was this

  @param int $ id       * @return \ Illuminate \ Http \ Response

I thought that the type of int $ id was predefined like this and not string, but thank you very much for clear explanation Neil.

daniel21gt left a reply on Convert Sql Query • 6 days ago

thanks very much matttonks11

daniel21gt started a new conversation Doubt With Methods --resource • 6 days ago

  • @param int $id

    • @return \Illuminate\Http\Response */ public function show($id) {

    }

Is it possible to modify the input parameter $ id for one $ string ?,

Or can I customize a different method to index, destroy, edit, update?

daniel21gt started a new conversation Convert Sql Query • 6 days ago

Quiero convertir una consulta sql en formato eloquent

select * from usuarios where usuario_ad = "danielad";

to

Usuarios::where("usuario_ad","=",'danielad');

But in eloquent it does not work I just receive this,

Illuminate\Database\Eloquent\Builder {#2892}

How could the correct translation of this query be in eloquent?

12th October, 2018

daniel21gt left a reply on Problem With Query Where Select • 1 week ago

I just want to filter a list with a where, so

select * from users where userad = danielad;

In my view I select an option

https://paste.laravel.io/1ccc28a5-232e-46b2-adda-7090f34208e2

then this selection sent it to my controller

https://paste.laravel.io/287f2e0e-356a-4e64-bd1d-c219a4753387

I just want to see the table with the data referring to "danielad"

11th October, 2018

daniel21gt started a new conversation Problem With Query Where Select • 1 week ago

I have tried to do a where query with a select options

@foreach($usuariosOpciones as $id => $usuario_ad) {{ $usuario_ad }}
                     <form action="{{route('registros.show', $id->$usuario_ad)}}" method="POST">
                          {{csrf_field()}}
                        <a class="btn btn-info" >Buscar</a>
                    </form>
                    @endforeach
               
             </div>  
          </div>

In this module I consult all the records, but I also want to select by username, I still do not get it.

view https://paste.laravel.io/505fad0a-3fb6-49d4-9465-1751e9de6136 controller https://paste.laravel.io/dfdbb2b5-8c9f-46b2-b9bc-38b5dc2a7cbe

Is it possible to do this in the same module?

10th October, 2018

daniel21gt left a reply on Configure Bcrypt • 1 week ago

Thanks wilk_randall, it worked perfect

daniel21gt started a new conversation Configure Bcrypt • 1 week ago

How are you

I'm doing a password update through my controller, about the update method, but I do not know how to configure bcrypt for the password field, do you know how I can fix this in the update?

public function update(Request $request, $id) {

    $password = bcrypt($request['password']);

    $this->validate($request,['name', 'last_name', 'username', 'email', 'password'=>'required|string|min:6|confirmed', 'password_confirmation'=>'required|min:6|same:password']);

    user::find($id)->update($request->all());
    return redirect()->route('ecuentas.index')->with('success','Registro actualizado satisfactoriamente');
}

6th October, 2018

daniel21gt left a reply on Problem Validation • 1 week ago

Thanks cronix, you were right, I was pointing to a GET route instead of POST, so validate in the same method to make it work, I am perfect.

https://paste.laravel.io/48fd9196-dd97-4d6c-b1b1-646b8ad8379b

daniel21gt left a reply on Problem Validation • 1 week ago

/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store() { $data = request()->validate([ 'name' => 'required|string|max:255', 'last_name' => 'required|string|max:255', 'username' => 'required|max:15|unique:users', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', 'tipos_usuarios_id' => 'required|integer', ]);

         User::create([
        'name' => $data['name'],
        'last_name' => $data['last_name'],
        'username' => $data['username'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'tipos_usuarios_id' => $data['tipos_usuarios_id'],
    ]);
    
     return redirect()->route('registros.index');
        
}

daniel21gt left a reply on Problem Validation • 1 week ago

Thanks cronix, you were right, I was pointing to a GET route instead of POST, so validate in the same method to make it work, I am perfect.

/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store() { $data = request()->validate([ 'name' => 'required|string|max:255', 'last_name' => 'required|string|max:255', 'username' => 'required|max:15|unique:users', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', 'tipos_usuarios_id' => 'required|integer', ]);

         User::create([
        'name' => $data['name'],
        'last_name' => $data['last_name'],
        'username' => $data['username'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'tipos_usuarios_id' => $data['tipos_usuarios_id'],
    ]);
    
     return redirect()->route('registros.index');
        
}

daniel21gt left a reply on Problem Validation • 1 week ago

This line indicates me

throw new MethodNotAllowedHttpException($others);

daniel21gt left a reply on Problem Validation • 1 week ago

The same error comes out, what always comes out is

C:\laragon\www\crudgobernaciontres\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php if ($request->method() == 'OPTIONS') { return (new Route('OPTIONS', $request->path(), function () use ($methods) { return new Response('', 200, ['Allow' => implode(',', $methods)]); }))->bind($request); }

    $this->methodNotAllowed($methods);
}

/**
 * Throw a method not allowed HTTP exception.
 *
 * @param  array  $others
 * @return void
 *
 * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
 */
protected function methodNotAllowed(array $others)
{
    throw new MethodNotAllowedHttpException($others);
}

/**
 * Get routes from the collection by method.
 *
 * @param  string|null  $method
 * @return array
 */
public function get($method = null)
{
    return is_null($method) ? $this->getRoutes() : Arr::get($this->routes, $method, []);
}

/**
 * Determine if the route collection contains a given named route.

5th October, 2018

daniel21gt started a new conversation Problem Validation • 2 weeks ago

good day

I want to validate some data before sending them to the database, but I get an error, 1. ""

This is my controller, open something bad in the validation?

https://paste.laravel.io/b7b439fd-02d6-43e3-ae5a-ce29a2e2a3ec

4th October, 2018

daniel21gt left a reply on Routes • 2 weeks ago

that's how it is normally, the record on the right

https://ibb.co/gifMde

but I want the register to be like crear cuentas

https://ibb.co/kFRYrz

daniel21gt left a reply on Routes • 2 weeks ago

Thanks snapey, I made the change correctly, but I still, you see, the option to register that has auth by default at the beginning of the session works, but I passed the option to register after logging in,

it should be http: //crudgobernaciontres.test/panel/register

but it is bad, it remains http: //crudgobernaciontres.test/register no found

daniel21gt started a new conversation Routes • 2 weeks ago

Where can I edit the default routes of Auth::routes ()?

in my route: list is

https://paste.laravel.io/9fbde6f5-ae4d-4c97-a3b1-21335f25bda0

but I need, that is

https://paste.laravel.io/14e67be2-74f6-4ded-8768-4c80a7647797

How can I make this change?

2nd October, 2018

daniel21gt left a reply on Problem Distinct • 2 weeks ago

wow cronix ... perfect .. you're very good thank you very much

daniel21gt left a reply on Problem Distinct • 2 weeks ago

Much better, I did not know how to separate two queries, now when I send this appears

"Trying to get property of non-object (View: C: \ laragon \ www \ crudgobernaciontres \ resources \ views \ User \ index.blade.php)"

daniel21gt left a reply on Problem Distinct • 2 weeks ago

If it is possible to put two queries in the same method?

controller https://paste.laravel.io/a7450efc-64a8-4085-9f31-2cb584159df3

I put the query in another variable $ users, but in the view it says that the variable is unknown

view https://paste.laravel.io/84b46b8e-f298-4cd8-9fef-98d8420af5d6

daniel21gt left a reply on Problem Distinct • 2 weeks ago

I've already found the problem, it's because I have another function

  public function index ()      {          //          $ users = users :: orderBy ('id', 'DESC') -> paginate (10);          return view ('user.index', compact ('users'));      }   for that reason they all continue to appear.

view https://paste.laravel.io/013ac619-adaa-4a84-85cf-5541ab0a1bcb

now I do not know what method to enter the instinct query in the controller

controller https://paste.laravel.io/79e7ecd5-e8e5-4ea2-b31a-5a58acbb789e

my goal is to create an option select and filter users

daniel21gt left a reply on Problem Distinct • 2 weeks ago

Ho ya encontre el problema, es por que tengo otra funcion

public function index() { // $usuarios=usuarios::orderBy('id','DESC')->paginate(10); return view('usuario.index',compact('usuarios')); }

por esa razon siguen apareciendo todos.

daniel21gt left a reply on Problem Distinct • 2 weeks ago

How strange ... continue the same ... I'll see what else I can do .. thanks cronix

daniel21gt left a reply on Problem Distinct • 2 weeks ago

Yes, work

+------------+ | usuario_ad | +------------+ | daniel | | pedro | | pedroad | +------------+

daniel21gt left a reply on Problem Distinct • 2 weeks ago

That's the weird thing, should it work, maybe Laravel 5.5 will have restrictions with this?

daniel21gt started a new conversation Problem Distinct • 2 weeks ago

I have a problem with the distinct clause, I currently have this code

  public function showRegistrationForm ()     {          $ usersad = \ DB :: table ('users') -> select ('user_ad') -> distinct () -> get ();          return view ('user.index') -> with ('users', $ usersad);      }

but it does not bring me only names, it brings them all to me, what could it be?

29th September, 2018

daniel21gt left a reply on Problem With Erasing Foreach • 2 weeks ago

Thank you very much, excuse me ... I'm learning.

daniel21gt started a new conversation Problem With Erasing Foreach • 2 weeks ago

I have a problem deleting data in a list, when I want to delete any user the first one is always deleted in the list and not the one I choose, instead with the edit button works perfect.

view https://paste.laravel.io/65ff39eb-7d7f-4a6e-bf32-4cec6ccddaed controller https://paste.laravel.io/da55cb41-0667-44da-bf14-ea9a50f3df1c

for example:

jors claiton marie charlie

if I erase marie it's erased jors

27th September, 2018

daniel21gt started a new conversation Current Session • 3 weeks ago

Is there a way to find out which user is currently in session through tinker?

26th September, 2018

daniel21gt started a new conversation Relationships In Models • 3 weeks ago

In the migrations I have correctly configured the foreign keys, so in php admin the information is consulted very well, my question is ....

Why is it necessary to configure the relationships in the models?

daniel21gt left a reply on Redirection Problem Register Controller • 3 weeks ago

solutions..

use Illuminate\Http\Request; use Illuminate\Auth\Events\Registered;

//we define our redirectTo protected $redirectTo = '/login';

//create a new method that overrides default register

public function register(Request $request)
{
    $this->validator($request->all())->validate();

    event(new Registered($user = $this->create($request->all())));

   // $this->guard()->login($user);
//this commented to avoid register user being auto logged in

    return $this->registered($request, $user)
        ?: redirect($this->redirectPath());
}

daniel21gt started a new conversation Redirection Problem Register Controller • 3 weeks ago

When I register a new user, the register controller keeps redirecting me to / home and not to / login

registercontroller : https://paste.laravel.io/e2743f87-6c98-4ef1-92e5-9c862420b556 RedirectUsers : https://paste.laravel.io/55f983e6-c9ce-44c5-885e-6d1240d2404e

error in web browser: http://crudgobernaciontres.test/home should appear http://crudgobernaciontres.test/login

daniel21gt left a reply on Problems With Data Entry • 3 weeks ago

yes.. 'tipos_usuarios_id' => 'required|integer', now work, thank you very much

25th September, 2018

daniel21gt started a new conversation Problems With Data Entry • 3 weeks ago

My form does not record data, it stays exactly in the same place, then I send the view and the controller.

view https://paste.laravel.io/ce574e04-1035-4262-8e34-ee813645a25f controller https://paste.laravel.io/75ace57a-7349-459b-b022-b168f4be726d routes https://paste.laravel.io/bec735a4-acc2-4513-90df-a3dc8fa3c2f2

It worked fine, but after adding a select option and the public function showRegistrationForm () method, it does not work anymore.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.