Maximus1

Maximus1

Member Since 1 Week Ago

Experience Points 90
Experience Level 1

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

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

15 Sep
5 days ago

Maximus1 left a reply on How To Get A Value Based On A Selected Variable In An Array

Can anyone please help resolve this issue?

12 Sep
1 week ago

Maximus1 left a reply on How To Get A Value Based On A Selected Variable In An Array

Now , i believe the issue is how to get the priceamount from the fee_type[] array.

The priceamount field will be diabled or read-only because it displays based on the feetype selected. When i tried inputting the priceamount manually, it saved ok without errors but i dont want users to have this control.

The solution will be how to get the priceamount from the fee_type[] array.

I dont know if i have to adjust something here :

<script type="text/javascript">
$('select[name=fee_type]').on('change',function(){
            var _token=$('input[name=_token]').val();
            var fee_id = $('select[name=fee_type]').val();
            $.ajax({
                type: "POST",
                url: "{{url('prices/fee_amount')}}",
                data:{_token:_token,fee_id:fee_id},
                success: function(data){
                    $('input[name=priceamount]').val(data);             
                }
            });
        }); 
</script>

OR here :

public function get_fee_amount(Request $request)
                              {
                           $feetype = FeeType::find($request->fee_id)->priceamount;
                           return $feetype;
                              }

Maximus1 left a reply on How To Get A Value Based On A Selected Variable In An Array

Thank you Snapey . It shows the amount now. It worked only when i also changed priceamount[] to priceamount but it wont save when i submit.

I get this error "Invalid argument supplied for foreach()"

This is the store section of the controller :

 public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            //
        ]);     
        
                
                //Store Price Item
                $counter = 0;
                foreach($request->input("fee_type") as $fee_id){
                    if($request->input("priceamount")[$counter] == 0 && $fee_id==""){
                        continue;
                    }
                    $priceItem = new PriceItem();
                    $priceItem->price_id = $price->id;
                    $priceItem->fee_id = $fee_id;
                    $priceItem->quantity = $request->input("quantity")[$counter];
                    $priceItem->priceamount = $request->input("priceamount")[$counter];
                    $priceItem->save();
                    
                    $counter++;
                }
            }
        

The error in on this line :

foreach($request->input("fee_type") as $fee_id){

Maximus1 left a reply on How To Get A Value Based On A Selected Variable In An Array

Can you please look into code? Any solutions?

Maximus1 started a new conversation How To Get A Value Based On A Selected Variable In An Array

I want to get and display the corresponding value of a selected variable in an array. I think did okay with the code but it is bringing no result. This value should be inputed automatically in the priceamount field when the corresponding fee type is selected.

BLADE-VIEW

<div>
<td width="40%"><select name="fee_type[]" class="form-control select2" required>
                    <option value="">{{_lang('Select One') }}</option>
                    {{ create_option('fee_types','id','fee_type',old('fee_id')) }}
                </select></td>                  
                    <td><input type="text" class="form-control float-field priceamount" name="priceamount[]"value="0" required></td>
</div>

<script type="text/javascript">
$('select[name=fee_type]').on('change',function(){
            var _token=$('input[name=_token]').val();
            var fee_id = $('select[name=fee_type]').val();
            $.ajax({
                type: "POST",
                url: "{{url('prices/fee_amount')}}",
                data:{_token:_token,fee_id:fee_id},
                success: function(data){
                    $('input[name=priceamount]').val(data);             
                }
            });
        }); 
</script>

CONTROLLER

 public function get_fee_amount(Request $request)
                              {
                           $feetype = FeeType::find($request->fee_id)->priceamount;
                           return $feetype;
                               }    

Now i am trying to get the corresponding priceamount from the fee_type selected but without success. It still does not show or get the priceamount value. Can anyone please help?