javieralex

Member Since 2 Months Ago

Experience Points
500
Total
Experience

4,500 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 Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 1
500 XP
Jan
19
1 week ago
Activity icon

Replied to How Can I Fix The Following Error When Updating My Image?

Thank you very much, you are absolutely right. Cheers

Activity icon

Started a new Conversation How Can I Fix The Following Error When Updating My Image?

Hi, I hope they are fine, I have a form to edit my profiles table but if I don't change the image it gives me the following error: Call to a member function extension () on null showing error on this line $ avatarName = time (). '.'. $ avatar-> extension ();

I am using laravel 8

this is my code of controller:

public function editProfile($id){

    $profile = Perfil::find($id);


    return view('edit-profile', compact('profile', $profile));
    
}


public function updateProfile(Request $request){

    $name  = $request->name;
    $age = $request->age;
    $weight  = $request->weight;
    $height  = $request->height;
   
    $avatar = $request->file('image');
    
    $avatarName = time().'.'.$avatar->extension();
    $avatar->move(public_path('storage/profile-photos'), $avatarName);

    $profile = Perfil::find($request->id);
    $profile->name = $name;
    $profile->age = $age;
    $profile->weight = $weight;
    $profile->height = $height;
   
    $profile->profile_photo_path = $avatarName;

    $profile-> save();

    return redirect('http://localhost:8000/profiles')->with('profile_updated', 'perfil actualizado correctamente');;
    
    
}

and my view:

                        @if(Session::has('profile_updated'))
                            <div class="alert alert-success" role="alert">
                           {{Session::get('profile_updated')}}
                            </div>
                        
                        @endif 

                        <form method="POST" action="{{route('profile.update')}}" enctype="multipart/form-data">

                        @csrf
                        
                        <input type="hidden" name="id" value="{{$profile->id_perfil}}" />

                        <div class="form-group">

                        <label for="name">name</label>
                        <input type="text" name="name" value="{{$profile->name}}" class="form-control" />

                        </div>

                        <div class="form-group">
                        <label for="age">age</label>
                        <input type="text" name="age" value="{{$profile->age}}" class="form-control" />
                        
                        </div>

                        <div class="form-group">
                        <label for="weight">weight</label>
                        <input type="text" name="weight" value="{{$profile->weight}}" class="form-control" />
                        
                        </div>

                        <div class="form-group">
                        <label for="height">height</label>
                        <input type="text" name="height" value="{{$profile->height}}" class="form-control" />
                        
                        </div>

                        <div class="form-group">

                        <label for="file">Choose</label>

                        <input type="file" name="image" class="form-control" onchange="previewFile(this)" />

                        <img id="previewImg" alt="profile image" src="{{asset('storage/profile-photos')}}/{{$profile->profile_photo_path}}" style="max-width:130px;margin-top:20px;"/>

                        </div>

                        <button type="submit" class="btn btn-primary"> Enviar</button>

                        

                    
                    </form>

How can I avoid sending the image in null? thanks

Jan
18
1 week ago
Activity icon

Started a new Conversation Hide Url Or Browser Variable

Hi, I have the following url when editing a field http: // localhost: 8081 / guest / 2 / edit.

Is there any way i can hide the id and get a cleaner path? laravel 8- thank you very much in advance

Jan
13
1 week ago
Activity icon

Replied to Email Redirection When You Register

Hi and Thank you very much, it is what you need.

Activity icon

Replied to Email Redirection When You Register

I don't have that file, I work with laravel 8.0 jetstream, or should I make those files public?

Activity icon

Started a new Conversation Email Redirection When You Register

Hi, I have a problem, Can I help me please? When a user registers, how to change where my application sends me when confirming an email by email? in laravel , currently send me to user view

thanks, regards

Dec
30
3 weeks ago
Activity icon

Started a new Conversation Doesn't Update Image When Editing

I have a crud with livewire from the profiles table, this one has an image. I can create, delete, view but I can't update the image. I have a blank image.

this is my code:

public function store(){

    $this->validate();
    
    Perfil::create([
        'name' => $this->name,
        'age' => $this->age,
        'height' => $this->height,
        'weight' => $this->weight,
        'id_user' =>  Auth::user()->id,
       
        $filename = $this->profile_photo_path->store('profile-photos', ['disk' => $this->profilePhotoDisk()]),
        'profile_photo_path' => $filename

    ]);
   


    $this->reset(['name','age','height','weight', 'profile_photo_path']);
}



public function edit(Perfil $perfil){


    $this->name = $perfil->name;
    $this->age = $perfil->age;
    $this->height = $perfil->height;
    $this->weight = $perfil->weight;
    $this->id_perfil = $perfil->id_perfil;
    $this->profile_photo_path = $perfil->profile_photo_path;
  

    $this->accion = "update";
}

public function update(){


    $perfil  = Perfil::find($this->id_perfil);

    $perfil->update([

        'name' => $this->name,
        'age' => $this->age,
        'height' => $this->height,
        'weight' => $this->weight,
       
        $filename = $this->profile_photo_path->store('profile-photos', ['disk' => $this->profilePhotoDisk()]),
        'profile_photo_path' => $filename

    ]);



  
 
    $this->reset(['name','age','height','weight', 'id_perfil', 'profile_photo_path' ,'accion']);
}

and this is my view.

profile photo

    @if ($accion == "store" ) 
    
    @if($profile_photo_path)
   
 
    <div class="self-center justify-center flex relative" >
                <img src="{{$profile_photo_path->temporaryUrl()  }}" alt="" class="w-32 h-32 rounded-full shadow-md"">
              
            </div>
    @endif


<input wire:model="profile_photo_path" type="file" name="profile-photo">
<br>
@if($errors->has('profile_photo_path'))
                    <span class="text-red-600 font-bold ">{{ $errors->first('profile_photo_path') }}</span>
                   
                      @endif

 @else ($accion == "edit")

<!-- star update -->


            
            <div class="self-center justify-center flex relative">

        


            <img src="{{ asset('storage/'.$profile_photo_path) }}" alt=""
                         class="w-32 h-32 rounded-full shadow-md">
                     
                         <i class="fas fa-pen cursor-pointer"></i>
            </div>
          
                 
                  <input wire:model="profile_photo_path" type="file" name="profile-photo">
                 


           
       @endif

I select to edit a profile and it shows me all its information, including the image, but when selecting a new one, the previous one is removed and replaced by a blank one.

Can you tell me what I'm doing wrong?

Dec
08
1 month ago
Activity icon

Started a new Conversation Save Variable And Use It Until Logout

hello, from my view I send the id by get of a user profile to another view, the problem is that when changing view this variable is lost. Is there a way to store it in cookies or files and that it remains until I close the session? And if in a few words I start a session and it sends me the option to choose a profile and it sends me in an arrangement the profile data to another view.

So I send my id in my view

href= {{ route('/userviews/trainingp', ['idp'=> $profile->id_profile]) }}">

route

Route::middleware(['auth:sanctum', 'verified'])->get('/userviews/trainingp/', [App\Http\Controllers\ProfilesController::class, 'Sendid'], function () { return view('userviews/trainingp'); })->name('/userviews/trainingp');

Senddid

public function Sendid() { $v1=$_GET['idp'];

    $profile= Profile::where ('id_profile', '=',  [$v1])->get();
   
  
   
    return view('/userviews/trainingp')->with('profile', $profiles);



    
   
}

Thank you

Dec
02
1 month ago
Activity icon

Started a new Conversation Bring Image From My Database To Edit

Hello, I want to edit my profile table and still change the image it has.

my code of my model is the following and I use livewire

use HasProfilePhoto;

public $appends = [
    'profile_photo_url',
];

public $nombre, $edad, $altura, $peso, $id_user, $id_perfil, $profile_photo_path;

public $accion ="store";

public function render()
{
    return view('livewire.perfilestable', [ 'perfiles' => Perfil::where('id_user', '=', Auth::user()->id)->get() ]);
}

public function edit (Perfil $perfil){

    $this->nombre = $perfil->nombre;
    $this->edad = $perfil->edad;
    $this->altura = $perfil->altura;
    $this->peso = $perfil->peso;
    $this->id_perfil = $perfil->id_perfil;

   
    $this->profile_photo_path =$perfil->profile_photo_path;
    $this->accion = "update";
}

public function update(){
    $perfil  = Perfil::find($this->id_perfil);

    $perfil->update([

        'nombre' => $this->nombre,
        'edad' => $this->edad,
        'altura' => $this->altura,
        'peso' => $this->peso,
        'profile_photo_path' => $this->profile_photo_path,
       

    ]);

  
 
    $this->reset(['nombre','edad','altura','peso', 'id_perfil']);
}

so I send to bring the other fields of my table to edit them but I can not bring the profile_photo_path field to display it in my view

 <label for="Foto" class="form-label">Foto de perfil </label>

  
    
    <img wire:model="profile_photo_path" class="h-10 w-10 rounded-full" src="profile_photo_path" alt="">

    </div>

    <div>
      <label for="name" class="form-label">Nombre</label>

      <input wire:model="nombre" id="name" placeholder="Ingrese un nombre" type="text" class="block w-full bg-gray-200 px-4 py-4 rounded text-gray-700 focus:bg-white focus:outline-none border border-gray-200 focus:border-gray-500">
    </div>

How could I bring it and visualize it in my view

thank you

Dec
01
1 month ago
Activity icon

Replied to Send Data From An Array To A View

more or less, when passing perfil-> id it sends me all the id that are in the query and I only want the one to select.

Activity icon

Started a new Conversation Send Data From An Array To A View

Good afternoon, I am resuming laravel and I am stuck in a problem. I have the following foreach to fetch data from my profiles table:

@foreach ($perfiles as $perfil)

<h3> {{$perfil->nombre}}<span>Edad:{{$perfil->edad}}</span></h3>

@endforeach

what I do with this is show all the profiles corresponding to a specific user.

login with an email and this email has different profiles.

That's when the arrangement comes in when I show them with a query to my model, but now I would like that when I click on any profile it only sends its information to another view and so for each one, like Netflix.

Do you know how I can get each id of each profile that the foreach gives me and send this id to another view?

thank you, regards

Nov
09
2 months ago
Activity icon

Replied to Version 8 Redirects

I made it.

Activity icon

Replied to Version 8 Redirects

Hi, can you help me? In jetstreams we have a default navigation drop down menu, how can I change according to the user's role, I already tried directly in the view with a condition and directly in app.blade. I would appreciate your help

Nov
04
2 months ago
Activity icon

Replied to Version 8 Redirects

With a switch case, would it work for more roles?

example 4 roles.

super admin, admin, master and user

Activity icon

Replied to Version 8 Redirects

have you got 3 role authentication?