prospero

Member Since 1 Month Ago

Experience Points
4,220
Total
Experience

780 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
6
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
4,220 XP
Apr
10
2 days ago
Activity icon

Replied to About Notification Queues

good, I must first find the correct multi-tenant set up and see if the package resolve the switch connection correctly. Necessarily I must look too on the Queue manager classes to see where the switch connection is done, for other packages I had to extends handlers, seem that this is a new case jjj. Thx @snapey

Activity icon

Replied to About Notification Queues

when you say "when you job is fetched"...at this point, I don't have any code for Jobs, I mean create job classes, or anything about. That's confuse for me on Laravel docs and need practical experienced here!

Activity icon

Replied to About Notification Queues

Yes, the user exist but in tenant database. Before try to handle queues, I send notifications without any issue to every tenant's user created, only with some delay. So, now I'm deploying queues and see that need some driver from Tenancy, I already install it, configure all as docs say, and keep getting the same Exception. I think, that maybe must see in the Queable manager classes for do a research about how works. Can you tell me which is the manager class (who handle the db table jobs and fail_jobs?)

Activity icon

Replied to About Notification Queues

Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Tenant\User]. in /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:482
Activity icon

Replied to About Notification Queues

I do, but some errors fails is show in console. I mean, I see the error when running the php artisan queue:work.

[2021-04-10 15:20:22][10] Failed:     App\Notifications\InviteUser

In job table is the row of the job but the notification isn't sent

Activity icon

Started a new Conversation About Notification Queues

I'm misunderstanding the Laravel doc set up of queues on notifications sent. Already create the notification class

class InviteUser extends Notification implements ShouldQueue
{
    use Queueable;
  //....

and my User model has the Notifiable trait. On notification I do

$user->notify(new InviteUser($user));

I try to set up the database queue driver and run the proper commands for migration. I still don't know about any external queue driver, this is a single queue I want to use to reduce the time of send a user's notification for better user experience, so I'm trying to keep it simple. What I'm missing?

Apr
08
4 days ago
Activity icon

Replied to Reset Input Field After 1 Min From Last Typed Character

Thanks, this help's me a lot

Activity icon

Replied to Problem With Fortify After Login Redirections.

Remain the Home Path in config/fortify.php as default ('home' => RouteServiceProvider::HOME,) and just change it in RouteServiceProvider. To see how Fortify implement this, check all the actionResponse (eg. LoginResponse, TwoFactorLoginResponse, etc.)...all point to the config file.

Apr
07
5 days ago
Activity icon

Replied to LiveWire Live Actions Question

@if ($service->success == 1) wire:click="success ({{ $service->id }},{{ $service->success=0 }})") .... remember close the @endif

You can handle that for diff ways, mine was just one. Maybe the method wasn't well, I can test that now $set('success','0'). This set the $this->success property, and you can be aware of this change with the updatedSucess().

public function updatedSuccess()
{
    $this->user->status = $this->success;
    $this->user->save();
}
Activity icon

Replied to Help With Livewire Search Component

Put in some side {{ $term }} and see if value is bind to frontend when you type some in input element...I mean, for discard rare behavior in all the blade

Activity icon

Replied to Problem With Fortify After Login Redirections.

In RedirectIfAuthenticated middleware you can see this

foreach ($guards as $guard) {
            if (Auth::guard($guard)->check()) {
                return redirect(RouteServiceProvider::HOME);
            }
        }

and if you look at RouteServiceProvider class you can see and handle

public const HOME = '/home';   
Activity icon

Replied to Help With Livewire Search Component

Once you have a property bind to an element, in this case an input, you don't need add value attribute: value="{{ $term }}"

Activity icon

Replied to LiveWire Live Actions Question

The wire:click you must do it in the span elements on each if-else statement

<span  class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800" @if ($service->success==1) wire:click="$set('success',0)" @elsif($service->success==0) wire:click="$set('success',1)" @endif>@if ($service->success==1) Success  @elsif($service->success==0) Not Success @endif</span>
Apr
06
6 days ago
Activity icon

Started a new Conversation Reset Input Field After 1 Min From Last Typed Character

Hi there, I need a solution for this, so think on this scenario. I have a form for user's reset password with some inputs fields for password (old, new and confirmation), the user types into but don't do any action (input field remain filled) and if for some reason he left the PC...for cases like this I want to perform an action, like reset the field after 1 min from the last typed character. How, using Livewire and JS maybe, can do this? Thanks in advance

Apr
04
1 week ago
Activity icon

Started a new Conversation Handling With @section In Blade

I need some light with next and explain a bit...In one of my components, I made optional parameter data binding by route like

Route::get('/show/{company?}', [ShowCompanyComponent::class])->name('show.company');

and in the component

public ?Company $company;

This work perfect for creation and editing companies. In the blade component I can check the $company property and define for render which title be yield like

@if(is_null($company))
     @section('title', 'Create Company')
@else
     @section('title', 'Edit Company')
@endif

And this works well to. Now, I need do something similar in other component but without use routes or any model binding through. Just depending of a property value will be rendered the portion of blade that correspond, something like

public $switchBladePortion = false;

public function mount($switchBladeParam=null)
{
       if(!is_null($switchBladeParam))
             $this->switchBladePortion = $switchBladeParam; 
}

///....

public function switchHandler()
{
    $this->switchBladePortion = !$this->switchBladePortion;
    if($this->switchBladePortion)
              $this->mount($this->switchBladePortion);    
}

and in the blade

@if($switchBladePortion)
     @section('title', 'First Portion Title')
@else
     @section('title', 'Second Portion Title')
@endif

//......
<button wire:click="switchHandler"> 

I'm trying to achieve on click, re-render the component to load the correspond title ... but this way isn't possible. Someone can bright me on this?

Apr
03
1 week ago
Activity icon

Replied to Call Another Component

What about the modals in the component, how you implement that? I mean, as I can see you have two button in one component, one render an itself and the other? Nested component? Or must redirect to the other component? Can you share the blades composition you have to achieve this?

Activity icon

Replied to Unique Rule After Validation

Ah ok. You already have a column to match with the concatenated string...don't get that, sorry. I don't know about a useful method for that, so I made it on hand including in rules a property with the concatenated string like

$this->concatString = $this->term.'-'.$this->year;
...
public function rules()
{
    ... 
    'concatString' => ['unique:tableName'] 
}

Of course you must have a "name" property, and you must handle that sensitive case.

Apr
02
1 week ago
Activity icon

Replied to Unique Rule After Validation

Do you have a column in db to store the concatenated string? This can avoid make different queries in joining the results for validation...it's just an idea. In this way you only need to add another property for the concatenated field and pass it to the validation rule

Mar
28
2 weeks ago
Activity icon

Replied to First Try In Livewire

step by step my friend! and came here whenever you need help

Mar
27
2 weeks ago
Activity icon

Replied to First Try In Livewire

Sincerely, the documentation from https://www.laravel-livewire.com/docs/2.x/quickstart was very clear and helpful for me. And some example from youtube jump a quick road for manage the initiation...I just came from 4 months ago with Laravel and Livewire and everyday learn something here and accomplish goals with the job's tasks.

Activity icon

Replied to First Try In Livewire

on create you can get the created Vehicle back...

$modelVehicle = Vehicle::create...;
User::find($this->userID)->update(['vehicle_id'=>$modelVehicle->id]);

I think this must work.

Activity icon

Awarded Best Reply on First Try In Livewire

$users is an elocuent collection of models that you retrieve from database, so I suggest you have another property for the user selected data (the id like you do).

public $userID;

and in the select

<select .... wire:model="userID">

so, when you get in the method for modelData()

'user' => $this->userID
Activity icon

Replied to First Try In Livewire

$users is an elocuent collection of models that you retrieve from database, so I suggest you have another property for the user selected data (the id like you do).

public $userID;

and in the select

<select .... wire:model="userID">

so, when you get in the method for modelData()

'user' => $this->userID
Mar
25
2 weeks ago
Activity icon

Awarded Best Reply on Help With Laravel Welcome Page

After create new project check in the web.php file and you can see declared route

Route::get('/', function () {
    return view('welcome');
});

So, after that you can look at the welcome.blade.php that must be rendering at beginning

Mar
24
2 weeks ago
Activity icon

Replied to Help With Laravel Welcome Page

After create new project check in the web.php file and you can see declared route

Route::get('/', function () {
    return view('welcome');
});

So, after that you can look at the welcome.blade.php that must be rendering at beginning

Mar
19
3 weeks ago
Activity icon

Awarded Best Reply on How To Pass Flash Notification In Parent Component?

Ok, I would do it like this. In table.blade.php (in desirable place)

//....
@if (session()->has('store'))
        <div class="alert alert-success">
                  {{ session('store') }}
        </div>
 @elseif (session()->has('edit'))
        <div class="alert alert-success">
                   {{ session('edit') }}
         </div>
 @endif
//....

in Table component

protected $listeners = [
   'showEmitedFlashMessage'
];

//....

public function showEmitedFlashMessage($action)
{
    if($action == 'edit') {
         session()->flash('edit','Loan Interval Updated Successfully.');
    } else {
         session()->flash('store','Loan Interval Created Successfully.');
    }    
}

And in the Form component

public function store()
{
        $action = '';
     //......
        if($this->lsId){
            LoanSecurity::find($this->lsId)->update($data);
            $action = 'edit';
        }else{
            LoanSecurity::create($data);
            $action = 'store';
        }
     //............
        $this->emit('showEmitedFlashMessage', $action);
}
Activity icon

Replied to How To Pass Flash Notification In Parent Component?

Ok, I would do it like this. In table.blade.php (in desirable place)

//....
@if (session()->has('store'))
        <div class="alert alert-success">
                  {{ session('store') }}
        </div>
 @elseif (session()->has('edit'))
        <div class="alert alert-success">
                   {{ session('edit') }}
         </div>
 @endif
//....

in Table component

protected $listeners = [
   'showEmitedFlashMessage'
];

//....

public function showEmitedFlashMessage($action)
{
    if($action == 'edit') {
         session()->flash('edit','Loan Interval Updated Successfully.');
    } else {
         session()->flash('store','Loan Interval Created Successfully.');
    }    
}

And in the Form component

public function store()
{
        $action = '';
     //......
        if($this->lsId){
            LoanSecurity::find($this->lsId)->update($data);
            $action = 'edit';
        }else{
            LoanSecurity::create($data);
            $action = 'store';
        }
     //............
        $this->emit('showEmitedFlashMessage', $action);
}
Activity icon

Replied to How To Pass Flash Notification In Parent Component?

Help me if I misunderstood something. You have too components, parent and child like table and form. In this case in your table.blade.php

<div>
//......

<livewire:form/>

//......
</div> 

Right? And in Table component

public function render()
    {
        return view('livewire.loan-security-table',[
            'loansecurities' => LoanSecurity::paginate(10)
        ]);
    }

Right? And in the Form component you have the store method

public function store(){

        // $this->editMode = false;

        $data = $this->validate([
            'loan_security' => 'required',
        ]);
        // dd($lsId);
        if($this->lsId){
            // dd($this->lsId);
            LoanSecurity::find($this->lsId)->update($data);
            session()->flash('edit','Loan Interval Updated Successfully.');
        }else{
            LoanSecurity::create($data);
            session()->flash('save','Loan Interval Created Successfully.');
        }

        $this->resetInputFields();
        $this->emit('refreshParent');
        $this->emit('closeLoanSecurityModal');

    }

Let me know if I'm ok so far understand your things

Activity icon

Replied to How To Check For Usertype And Redirect To Dashboard

You can do it in a middleware, also Login event and create a listener for it and do the job

Activity icon

Replied to Checking The Thread Table If It Is Marked As Solved

$thread->comments retrieve a collection, so you have to iterate through and get the instance you want for $comment

Activity icon

Replied to Laravel Livewire: Variable From Component To Blade

The blade belong to other component? if it's you can pass the variable to parent component B and show it then in the blade

Mar
18
3 weeks ago
Activity icon

Awarded Best Reply on Disable Inputs If Checkbox Is Checked...

You can check for checkbox changes

public function updatedPaidCash()
{
     if($this->paid_cash)
         $this->isDisabled = true;
     else
         $this->isDisabled = false;
}

Right now can't remember if checked is 0 or 1, or true or false, so you can handle that by this approach

Activity icon

Replied to Disable Inputs If Checkbox Is Checked...

You can check for checkbox changes

public function updatedPaidCash()
{
     if($this->paid_cash)
         $this->isDisabled = true;
     else
         $this->isDisabled = false;
}

Right now can't remember if checked is 0 or 1, or true or false, so you can handle that by this approach

Activity icon

Replied to Unable To Destroy An ID

make a dd($FavFilm) and be sure that you're retrieving a FavFilm object. But, if no magic things happen you need to get a fresh elocuent model for delete

 public function destroy($FavFilm)
    {
        if($model = FavFilm::find($FavFilm)->delete()) {
            return response()->json([
                'status' => true,
                'FavFilm' => $model
                ]
            );
        } else {
       //

I think that this is the idea, not tested Update: yeahhh, and like @tykus recommend too!

Activity icon

Replied to How To Check If A Value Is Empty

<label for="fname">CompanyCode:</label 

<input type="text" id="fname" name="fname" value="{{ $id->CompanyCode }}" {{ $id->CompanyCode == '' ? 'disabled' : ''}}>

Update: don't see the answer of @tykus above...is right too

Mar
16
3 weeks ago
Activity icon

Replied to How To Implement Bootstrap DataTable In Livewire?

Follow this video tutorial...it's very good to dev for Livewire. Hope this help you https://www.youtube.com/watch?v=1HjXpT7Oexg&list=PLSP81gW0XjNFP8RTBLMb1KL7Qbr8hUjr4&index=10

Mar
12
1 month ago
Activity icon

Replied to Change Value Is Database

$page->views = $page->views +1;
$page->save();
Mar
09
1 month ago
Activity icon

Replied to Email Alerts Subscribers: How To Verify Email In Laravel?

Hey there. Recently I do something related with...In my case after create new User this gonna be notify by email about this like an invitation, and if this click on button return him to the reset password view. When I send the email, I create a token to verify that the user exist and for some security things. So, first I create the InviteUser notification like:

class InviteUser extends Notification
{
    use Queueable;

    public $company;
    public $user;
    public $token;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($company,$user)
    {
        $this->company = $company;
        $this->user = $user;
        $this->token = Str::random(60);
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail', 'database'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        $url = 'http://url/notify/'.$this->user->id.'/'.$this->token;
        return (new MailMessage)
            ->subject('Invitation')
            ->markdown('mail.invite.user',['url' => $url]);
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            'invitation_token' => $this->token
        ];
    }

and when create new user:

$user->notify(new InviteUser($company,$user));

Ok, when the user click on link is redirect to the site, so I need a route that handle that like:

Route::get('/notify/{id}/{token}',[\App\Http\Controllers\InviteHandler::class,'getInviteData']);

In InviteHandler controller:

public function getInviteData($id,$token)
    {
        $user = User::find($id);
        $user_token = '';
        if () {
            //do the stuffs for check the users exists and compare tokens
            if ($token == $user_token)
                return view('invitation.notifiable-view',['user' => $user]);
        }
        else {
            return redirect()->route('login')->with('already', 'Already activated!');
        }
    }

public function update(Request $request)
    {
        $user = User::find($request->get('user_id'));

        //the stuffs for reset password

        return redirect()->route('login')->with('success', 'Activation successfully!');
    }

And the notifiable-view is a simple form for password and confirmation password inputs that perform action by post method to update function. That's all, hope this make more clear to your deployment.

Mar
06
1 month ago
Activity icon

Awarded Best Reply on How To Add CDN For Css Inside One Livewire Component Only ?

in layouts.app you must have the directive @yield('custom_css') before @livewireStyles, and in blade component you can do

@section('custom_css')
     //....CDN
@endsection
Mar
05
1 month ago
Activity icon

Replied to How To Get To Tenants Data Throw Central Admin Panel ?

Now that I see the package you are using, seem that isn't the same that I'm deploying...https://tenancy.dev/docs/tenancy/1.x. Sorry

Activity icon

Replied to How To Get To Tenants Data Throw Central Admin Panel ?

Tenancy have some methods for that, to switch or set the connection to handle tenant's db. For example, Tenancy::getTenant(), setTenant($tenant),identifyTenant()...

For example, if you want retrieve the products data from a specific tenant, is something like:

public function getTenantProducts($tenant)
{
    Tenancy::setTenant($tenant);
     $product = App\Models\Tenant\Product::all();
}

Hope this help you a little

Activity icon

Replied to Livewire Do Not Show The Data With Out The Page Reload

sorry. After create, do $this->post->refresh;

Activity icon

Replied to Livewire Do Not Show The Data With Out The Page Reload

Maybe, but not need more code for twice and got the same result

Activity icon

Replied to Livewire Do Not Show The Data With Out The Page Reload

Instead retrieve comments data in mount method try to do that in render

public function render()
{
      $this->comments = $this->post->comments();
      return view('livewire.comments', ['comments' => $this->comments]);
}
Activity icon

Replied to How To Add CDN For Css Inside One Livewire Component Only ?

in layouts.app you must have the directive @yield('custom_css') before @livewireStyles, and in blade component you can do

@section('custom_css')
     //....CDN
@endsection
Mar
04
1 month ago
Activity icon

Replied to How To Return Response Of Collection Of Notifications To Blade?

This is the way to share data with your blade from controller. If you want some reactive way you need use some front-end framworks or js for it instead refresh page for load data.

Activity icon

Replied to How To Return Response Of Collection Of Notifications To Blade?

public function index()
{        
 return view('user-notifications', ['notifications' => auth()->user()->unreadNotifications]);
}
Activity icon

Replied to Jetstream Disable Auto Create Team At Register

Using Fortity, in create method of CreateNewUser.php just comment the Team correspondig line:

return tap(User::create([
                'name' => $input['name'],
                'email' => $input['email'],
                'password' => Hash::make($input['password']),
            ]), function (User $user) {
                //$this->createTeam($user);
            });
Mar
02
1 month ago
Activity icon

Replied to Livewire Not Updating A Value

That's very rare! Really

Activity icon

Replied to Livewire Not Updating A Value

All well for me...dude, I can't explore in any more places, really don't know where is the issue. Please if you solve this, let us know then please. Sorry