tlodge

tlodge

Member Since 3 Months Ago

Experience Points
7,250
Total
Experience

2,750 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
70
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.

Level 2
7,250 XP
Sep
17
1 month ago
Activity icon

Started a new conversation Algolia Places Removing The First Line Of Address Before Submitted

I've set up a form on a page, with two address fields for different people. The first submits fine, the second address is found fine by Algolia places and the Line 2, city and postcode are all filled in. But when submitted the first line of the address is not submitted. If I remove Algolia places then the form submits correctly so it seems to be a JS error rather than a laravel. Here's my code below if it helps

(function() {
  var placesAutocomplete = places({
    appId: 'plCA19E07224',
    apiKey: '073a4e056abca25a45f9b855a802beb5',
    container: document.querySelector('#address'),
    templates: {
      value: function(suggestion) {
        return suggestion.name;
      }
    }
  }).configure({
    type: 'address'
  });
  placesAutocomplete.on('change', function resultSelected(e) {
    document.querySelector('#address2').value = e.suggestion.suburb || '';
    document.querySelector('#addresscity').value = e.suggestion.city || '';
    document.querySelector('#addresspostcode').value = e.suggestion.postcode || '';
  });
})();
</script>
<script>
(function() {
  var placesAutocomplete2 = places({
    appId: 'plCA19E07224',
    apiKey: '073a4e056abca25a45f9b855a802beb5',
    container: document.querySelector('#partnersaddress'),
    templates: {
      value: function(suggestion) {
        return suggestion.name;
      }
    }
  }).configure({
    type: 'address'
  });
  placesAutocomplete2.on('change', function resultSelected(e) {
    document.querySelector('#partnersaddress2').value = e.suggestion.suburb || '';
    document.querySelector('#partnersaddresscity').value = e.suggestion.city || '';
    document.querySelector('#partnersaddresspostcode').value = e.suggestion.postcode || '';
  });
})();
</script>
Aug
28
1 month ago
Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

thank you for your help, I've managed to get it working as it now should.

However how do I include multiple calculations relating to other data from the form. Is it by setting up a new vue instance or is there a way to tag on to the current one?

Aug
23
1 month ago
Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

So the input box is:

<input type="number" class="form-control" name="lifecovertotal" value="{{ old('lifecovertotal') }}" Placeholder="Life Cover Total" v-model="lifecovertotal">

When moving on to that tab it is currently just showing the placeholder of "Life Cover Total".

Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

So currently just showing the placeholder, rather than a value

Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

It is now just not calculating

Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

I've corrected, still doesn't seem to work though.

Activity icon

Replied to VueJS Concatenating The Variables Rather Than Addition

I've tried parseInt() but it seems to stop it working, am I using this correctly?

    new Vue({
        el:'#app',
        data : {
                lifecoverproperty: '',
                lifecoverloan: '',
                lifecoverlivingexpenses: '',
                lifecoverlivingexpensesterm: '',
                lifecoverchildcare: '',
                lifecoverchildcareterm: '',
         },
        computed: {
                lifecovertotal() {
                    return parseInt(this.lifecoverproperty) + parseInt(.lifecoverlivingexpenses) * parseInt(this.lifecoverlivingexpensesterm) + parseInt(this.lifecoverchildcare) * parseInt(this.lifecoverchildcareterm);
                }
            }
    });
</script>
Aug
22
1 month ago
Activity icon

Started a new conversation VueJS Concatenating The Variables Rather Than Addition

Trying to run some addition with multiplication for a form however the JavaScript is concatenating the string rather than performing the addition.

    new Vue({
        el:'#app',
        data : {
                lifecoverproperty: '',
                lifecoverloan: '',
                lifecoverlivingexpenses: '',
                lifecoverlivingexpensesterm: '',
                lifecoverchildcare: '',
                lifecoverchildcareterm: '',
         },
        computed: {
                lifecovertotal() {
                    return this.lifecoverproperty + this.lifecoverlivingexpenses * this.lifecoverlivingexpensesterm + this.lifecoverchildcare * this.lifecoverchildcareterm;
                }
            }
    });
</script>
Aug
08
2 months ago
Activity icon

Replied to Trying To Pass A Variable From First Table To The Create Form For The Second Table

BelongsTo

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class lifepolicy extends Model
{
    public function client()
    {
        return $this->belongsTo(Client::class);
    }
}
Activity icon

Replied to Trying To Pass A Variable From First Table To The Create Form For The Second Table

hasMany

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{
    protected $guarded = [
        'id'
    ];

    public function lifepolicies()
    {
        return $this->hasMany(Lifepolicy::class);
    }
}

and belongsTo:

~~~<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class lifepolicy extends Model
{
    public function client()
    {
        return $this->belongsTo(Client::class);
    }
}
Activity icon

Replied to Trying To Pass A Variable From First Table To The Create Form For The Second Table

My life controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Lifepolicy;
use App\Client;

class LifepolicyController extends HomeController
{
    
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $lifepolicies = Lifepolicy::all();

        return view('lifepolicies.index', compact('lifepolicies'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create(Client $client, Lifepolicy $lifepolicy)
    {
        $life = Client::find($Clients_id)->life()->get();
        return view('client.life.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show(Client $Client)
    {
        //;
    }
    

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
Activity icon

Replied to Trying To Pass A Variable From First Table To The Create Form For The Second Table

For some reason all my files didn't post so my routes file:

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


Auth::routes();

Route::resource('client', 'ClientController');


Route::resource('client/{client}/lifepolicy', 'LifepolicyController');

Route::get('/home', '[email protected]')->name('home');
Activity icon

Started a new conversation Trying To Pass A Variable From First Table To The Create Form For The Second Table

I have two tables currently liked with the hasMany and belongsTo. hasMany is "clients", belongsTo in this case is "lifepolicy". I'm currently writing the "create" part for the life form.

I am getting the error that the client variable cant not be found, this is in to parts the original form submission which is the form role part '''''' and when trying to pass a variable '''{{ $client->firstname }}''' .

My create file:

'''

<style>
    body { padding-top: 40px; }
</style>

            <h2>Financial Dependent's Details</h2>
            <br>

            <form role="form" method="POST" action="/client/{{ $client->id }}/lifepolicy">
                {{ csrf_field() }}
            <div class="field">
            <label class="label" for="financialdependents">Name</label>
            <div class="control">
                    <input class="input" type="text" name="financialdependents" value="{{ old('financialdependents') }}" Placeholder="Financial Dependents Name"><br>
                    </div></div>
                    <div class="field">
                        <label class="label" for="financialdependentsage">Age</label>
                    <div class="control">
                    <input class="input" type="text" class="form-control" name="financialdependentsage" value="{{ old('financialdependentsage') }}" Placeholder="Age">
                    </div></div>
                    <div class="field">
                        <label class="label" for="financialdependentsresidence">Resedential Status</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsresidence" value="{{ old('financialdependentsresidence') }}" Placeholder="Resedential Status">
                    </div></div>
            <div class="field">
                        <label class="label" for="financialdependentsrelationship">Relationship</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsrelationship" value="{{ old('financialdependentsrelationship') }}" Placeholder="Relationship"></div></div>
                    <div class="field">
                        <label class="label" for="financialdependents2">Name</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependents2" value="{{ old('financialdependents2') }}" Placeholder="Financial Dependents Name">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsage2">Age</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsage2" value="{{ old('financialdependentsage2') }}" Placeholder="Age">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsresidence2">Resedential Status</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsresidence2" value="{{ old('financialdependentsresidence2') }}" Placeholder="Resedential Status">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsrelationship2">Relationship</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsrelationship2" value="{{ old('financialdependentsrelationship2') }}" Placeholder="Relationship">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependents3">Name</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependents3" value="{{ old('financialdependents3') }}" Placeholder="Financial Dependents Name">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsage3">Age</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsage3" value="{{ old('financialdependentsage3') }}" Placeholder="Age">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsresidence3">Resedential Status</label>
                        <div class="contol">
                        <input class="input" type="text" class="form-control" name="financialdependentsresidence3" value="{{ old('financialdependentsresidence3') }}" Placeholder="Resedential Status">
                    </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsrelationship3">Relationship</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsrelationship3" value="{{ old('financialdependentsrelationship3') }}" Placeholder="Relationship">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependents4">Name</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependents4" value="{{ old('financialdependents4') }}" Placeholder="Financial Dependents Name">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsage4">Age</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsage4" value="{{ old('financialdependentsage4') }}" Placeholder="Age">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsresidence4">Resedential Status</label>
                        <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsresidence4" value="{{ old('financialdependentsresidence4') }}" Placeholder="Resedential Status">
            </div></div>
                        <div class="field">
                        <label class="label" for="financialdependentsrelationship4">Relationship</label>
                            <div class="control">
                        <input class="input" type="text" class="form-control" name="financialdependentsrelationship4" value="{{ old('financialdependentsrelationship4') }}" Placeholder="Relationship">
                        </div></div>
            
        </tab>
 
        
        <tab name="Personal Details">
            <h1>Personal Details</h1>
        </tab>
        <br>
        
        <div class="field"> 
                        <label class="label" for="smoker">Smoker Status for {{ $lifepolicy->owner->firstname }} </label>
                        <div class="control">
                            <div class="select" name="smoker" value="{{ old('smoker') }}">
                                <select>
                                <option>-- Select --</option>
                                <option>Yes</option>
                                <option>No</option>
                                </select>
                                <br>
                            </div>
                        </div>
        </div>
       
        <tab name="third tab">
            <h1>third tab.</h1>

        </form>
        </tab>
    </tabs>
</div>
   </div>
</div>

<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="{{ asset('js/main.js') }}"></script>
'''

My routes file:

'''