fanisa

Member Since 3 Months Ago

Experience Points
550
Total
Experience

4,450 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
550 XP
Feb
13
2 months ago
Activity icon

Replied to Save File On Upload (array Of Images, One File Model)

ok, in this case how can I retrieve the file instance, than was returned by wire:model?

Activity icon

Started a new Conversation Save File On Upload (array Of Images, One File Model)

Hello! I have some images

@foreach($images as $image)
		...
        <input type="file" wire:model="newImage" />
		...
		<button wire:click="save({{ $loop->index }})">Save</button>
@endforeach

I don't want to use any submit button to save the image, just save it on uploading

For example,

public function updatedNewImage()
    {
        // here I need to retrieve $index
    }

How to do this?

Feb
07
2 months ago
Activity icon

Replied to Pass Variable To Component Tag Name

Yeah! That's it! Thank you!

Activity icon

Started a new Conversation Pass Variable To Component Tag Name

For example, in this code:

@foreach($sections as $section)
	 <x-site.landing.slider/>
@endforeach

Against of 'slider' I need to pass $section->tag

Jan
30
2 months ago
Activity icon

Replied to Editing Values At Nested Components

Yes, this is exactly what it was before I wanted to simplify and split the code)) But it turned out the opposite... Fixed as it was. This is really more correct. Thank you!

Jan
29
2 months ago
Activity icon

Started a new Conversation Editing Values At Nested Components

Hello everyone! Help me please to understand this issue... (I simplify the code to be more clear)

There is a parent livewire component products.blade.php:

@foreach($products as $product)
     <livewire:product-item :product="$product" />
@endforeach

and its nested components product-item.blade.php where you can edit product’s properties:

<input type="text" wire:model="product.title">
<input type="text" wire:model="product.price">

So validations rules are at ProductItem.php:

public $product;

protected $rules = [
        'product.title' => 'required|max:255',
        'product.price' => 'required|numeric',
    ];

public function updated($propertyName)
    {
        $this->validateOnly($propertyName);
    }

At first glance, everything seemed simple, until some problems began to surface. For example, if you change the value of a field, you need to call the event to the parent component to overwrite the new value at $products ...

Another problem... while filling the fields (price, title...) they are validated by ProductItem component. But I want them also to be validated at the parent component Products.php while submitting:

public function submit()
    {
        //$validatedData = $this->validate();
    }

Evidently, $this->validate will cause the error because there are no validations rules... Override them... it seems to be not a good idea.

So I think it was not a good approach at all, or I miss something ?

Jan
17
2 months ago
Activity icon

Replied to JetStream Profile Management - UpdateProfileInformationForm.php

Super! It does work! It's a magic piece of code, that I needed:

Livewire::component('profile.update-profile-information-form', UpdateProfileInformationForm::class);

Thank you so much, genius!)

Activity icon

Replied to JetStream Profile Management - UpdateProfileInformationForm.php

Hi! I've published them before. So I have and can edit the view resources\views\profile\update-profile-information-form.blade.php. Also, I have access to the class UpdateUserProfileInformation.php from \app\Actions\Fortify\UpdateUserProfileInformation.php where I can change the set of fields for example. But... this function

public function updateProfileInformation(UpdatesUserProfileInformation $updater)
    {
        $this->resetErrorBag();

        $updater->update(
            Auth::user(),
            $this->photo
                ? array_merge($this->state, ['photo' => $this->photo])
                : $this->state
        );

        if (isset($this->photo)) {
            return redirect()->route('profile.show');
        } 

        $this->emit('saved');

        $this->emit('refresh-navigation-dropdown');
    }

is located at another class from \vendor\laravel\jetstream\src\Http\Livewire\UpdateProfileInformationForm.php There is no such file at app\Http\Livewire

Jan
16
2 months ago
Activity icon

Started a new Conversation JetStream Profile Management - UpdateProfileInformationForm.php

Hello! There is a very interesting class in JetStream - UpdateProfileInformationForm which is situated at vendor folder. I can't edit it, I know, but there are two things, that I want to change in it. At this function:

public function updateProfileInformation(UpdatesUserProfileInformation $updater)
    {
        $this->resetErrorBag();

        $updater->update(
            Auth::user(),
            $this->photo
                ? array_merge($this->state, ['photo' => $this->photo])
                : $this->state
        );

        if (isset($this->photo)) {
            return redirect()->route('profile.show');
        }

        $this->emit('saved');

        $this->emit('refresh-navigation-dropdown');
    }

If a user do something with a photo, it is redirected, and I can no longer reach the events that go further, what I need. All I want to do, is to remove this block of code:

 if (isset($this->photo)) {
            return redirect()->route('profile.show');
        }

What is the best way to do it?

The second thing is that I want to add a property to this class, for example to do this:

<livewire:profile.update-profile-information-form :title="$title"/>

I think the solution should be the same as for the first question....

Jan
14
2 months ago
Activity icon

Replied to Two Traits With The Same Property

Yes, you're right, I've already understood this and completely changed the code.

Activity icon

Started a new Conversation Two Traits With The Same Property

I have two traits with the same protected property $rules: WithAddressFields.php

protected $rules = [
        'state.address' => ['required', 'string', 'max:255'],
        'state.address2' => ['nullable', 'string', 'max:255'],
	...
    ];

WithCreateUserFields.php

protected $validation_rules = [
        'name' => ['required', 'string', 'max:255'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'confirmed'],
        'phone' => ['required', 'string', 'max:20', 'unique:users'],
    ];

And I use them both at Livewire component:

 use WithAddressFields;
 use WithCreateUserFields;

So obviously I have an error:

App\Http\Traits\WithAddressFields and App\Http\Traits\WithCreateUserFields define the same property ($rules) in the composition of App\Http\Livewire\Site\Checkout

Actually, I can give another name to $rules and do something like this:

$this->validateOnly($propertyName, $this->validation_rules);

but it seems to me not correct at all) Which is the proper approach?

Jan
12
3 months ago
Activity icon

Replied to JetStream Profile-photos Not Showing

Ok, the url is correct and the image is shown at the console debugger properly... The problem was with Tailwind styles (I think) as I don't use this stylesheet. And the image was minuscule (because of font-size 13px of span) and it was out of visible area. I'll fix that without a problem. Thank you for help!

Activity icon

Replied to JetStream Profile-photos Not Showing

Oh, yes! Thank you! You're a genius) I haven't even written that I'd created the storage folder manually) That was the problem... I deleted it, and it works. But there is a little problem... The preview is not shown. Can you tell me please, what is the reason for this?

<div class="mt-2" x-show="photoPreview">
                    <span class="block rounded-full w-20 h-20" x-bind:style="'background-size: cover; background-repeat: no-repeat; background-position: center center; background-image: url(\'' + photoPreview + '\');'" style="background-size: cover; background-repeat: no-repeat; background-position: center center; background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT...');">
                    </span>
                </div>
Activity icon

Replied to JetStream Profile-photos Not Showing

I haven't changed the standard folders structure. And there are no files at \public\storage\profile-photos, there's not even a folder 'profile-photos' there (even if I create it manually, the files are not stored in it). The photos are stored only at project\storage\app\public\profile-photos

Activity icon

Replied to JetStream Profile-photos Not Showing

the hundred and first time? do you think it will help?)

Activity icon

Started a new Conversation JetStream Profile-photos Not Showing

I know this topic was discussed many times and I've tried to solve it with all proposed methods but in vain(( I really need help! That is what I have:

APP_URL=http://ordimedia.test

filesystems.php

'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

in database:

profile_photo_path: "profile-photos/h8rBIhx6bVHqUDqVqOSoc7NIgfYhW67hHN2sldLK.jpeg"

getProfilePhotoUrlAttribute() returns

profile_photo_url
=> "http://ordimedia.test/storage/profile-photos/h8rBIhx6bVHqUDqVqOSoc7NIgfYhW67hHN2sldLK.jpeg"

files are stored at

\storage\app\public\profile-photos

in view:

<img src="http://ordimedia.test/storage/profile-photos/h8rBIhx6bVHqUDqVqOSoc7NIgfYhW67hHN2sldLK.jpeg" >

And yes, I've done "php artisan storage:link" hundreds times, but the photo still not found