theUnforgiven

theUnforgiven

Member Since 5 Years Ago

UK

Web Developer at NRS

Experience Points 274,130
Experience Level 50

0 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 1523
Lessons
Completed
Best Reply Awards 45
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.

23 Jul
4 weeks ago

theUnforgiven commented on Tabs

Awesome stuff Jeffrey, been waiting for this lesson for some time :)

05 Jul
1 month ago

theUnforgiven left a reply on Route [password.reset] Not Defined.

php artisan make:auth should have done all this for you.

02 Jul
1 month ago

theUnforgiven left a reply on Editing Uploaded PDF Documents, Converting To HTML

@NOMGUY - Yes, seems that way, never mind. I've hacked it together for now

theUnforgiven left a reply on Editing Uploaded PDF Documents, Converting To HTML

Yes it does seem that way, but the above package mentioned does do the trick to some extent, but like I said it inlines everything and looks odd then.

theUnforgiven left a reply on Editing Uploaded PDF Documents, Converting To HTML

This is what I am using, but it inlines everything and sticks on lots of left, top & position properties, therefore when I convert back to PDF the layout is all out of line.

01 Jul
1 month ago

theUnforgiven started a new conversation Editing Uploaded PDF Documents, Converting To HTML

I have asked this question before, but I don't think I made myself clear on what I was hoping to get answers for, so figured I'd post again and see what responses you lovely people come back with.

I'm building a system whereby a user can upload a document (usually it'll be a PDF). Each PDF will be in some way different; I wish to know is there a sensible way to convert the PDF to HTML or something, then have the user say where they want the variables (so like name, address, signatures etc) then have some JS to do the leg work on that.

So my question is really can this be done, any suggestions on how; or if you know of anything similar, any links would be awesome to check out also.

30 Jun
1 month ago

theUnforgiven left a reply on Running Jobs On Scheduler

Ok, but how would the $setting variable be passed form the job to the command though, or is that where the last line you mentioned comes into play?

29 Jun
1 month ago

theUnforgiven left a reply on Running Jobs On Scheduler

Although that does make sense, still unsure what and how you mean.

theUnforgiven left a reply on Running Jobs On Scheduler

For example I have Monitor::dispatch($setting); in my controller, although I want this to run every 5 mins, but I can't seem to figure out how to pass $setting to the command or kernel.

theUnforgiven started a new conversation Running Jobs On Scheduler

Is there a way to run a job on the scheduler command with a param passed through also?

Basically I want to run the job every 5 mins last say, or does that not matter as the queue will be running continuous when I use Laravel Forge?

28 Jun
1 month ago

theUnforgiven left a reply on Parsing Variables In PDF

Figured document.getElementsByTagName('html')[0].innerHTML; would do the trick and save the full rendered HTML

theUnforgiven left a reply on Parsing Variables In PDF

Yes I can see the PDF working, but because I store the HTML without the vars been rendered thats my problem, so just thinking perhaps I need to render the page with pre-filled vars in, then save the whole html at that point to then convert to PDF. But question is how?

theUnforgiven left a reply on Parsing Variables In PDF

Or is there a way to save the full rendered html with the variables pre-filled in from the database on a view page

theUnforgiven started a new conversation Parsing Variables In PDF

Is there a way to parse PHP variables when converting to PDF, I have some html saved in the db like so:

<p class="ft04" style="margin: 0; padding: 0; font-size: 14px; font-family: Times; color: #000000; position: absolute; top: 235px; left: 126px; white-space: nowrap;">{{ $date }}</p>
<p class="ft04" style="margin: 0; padding: 0; font-size: 14px; font-family: Times; color: #000000; position: absolute; top: 591px; left: 705px; white-space: nowrap;"> @if($tenancy->property->rent_frequency == '4weeks') &#10003; @endif</p>

But when I use laravel-dompdf, the vars don't render, the PDF shows it as:

Date: {{ $date }}
This agreement is between us:

{{ $tenancy->landlord->name }}

Is there a way to make this work or any solutions?

Thanks in advance :)

21 Jun
2 months ago

theUnforgiven left a reply on Each VueJS Help

anyone willing to help a brother out?

theUnforgiven started a new conversation Each VueJS Help

I have a bunch of checkboxes then a change method in Vue as follows:

groupSelected(index, item) {
        let groupDocs = this.groupDoc;
                groupDocs.map(function(value, key) {
                   
        });
}

this.groupDoc is an array when selected;

// Vue Devtools

groupDoc:Array[2]
     0:"UK birth or adoption certificate"
     1:"Full or provisional UK driving license"

So I basically want to add each of these and there will only ever be 2 as there's a limit of 2 on there, so add each of these to new these:

// in data obj

docOne: '',
docTwo: '',

So these can the show within a div on the page to display to the user

20 Jun
2 months ago

theUnforgiven left a reply on Check If Checkboxes Are Check And Limit To 2 [VueJS]

I figured it out by a little googling, adding the options with an array in the data object, I was able to do the following which works:

<div v-for="(item, index) in groupDocuments">
        <label class="font-md"><input type="checkbox" :value="index" name="groupDoc" v-model="groupDoc" :disabled="groupDoc.length >= limit && groupDoc.indexOf(index) == -1" /> {{item}}
        </label>
</div>

theUnforgiven started a new conversation Check If Checkboxes Are Check And Limit To 2 [VueJS]

Hi all,

I have a bunch of checkboxes like this:

  <div class="col-xs-12 col-sm-12 col-md-12"> 
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="UK birth or adoption certificate"> UK birth or adoption certificate<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="Full or provisional UK driving license"> Full or provisional UK driving license<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from HM Prison"> A letter from HM Prison</li><br/>
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from a UK government department or Local Authority"> A letter from a UK government department or Local Authority<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from National Offender Management Service"> A letter from National Offender Management Service<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="Evidence of current or previous service in the UK armed forces"> Evidence of current or previous service in the UK armed forces<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from a police force confirming that certain documents have been reported stolen"> A letter from a police force confirming that certain documents have been reported stolen<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from private rented sector access scheme"> A letter from private rented sector access scheme<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter of attestation from an employer">A letter of attestation from an employer<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter from a UK further or higher education institution"> A letter from a UK further or higher education institution<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="A letter of attestation from a UK passport holder working in an acceptable profession"> A letter of attestation from a UK passport holder working in an acceptable profession<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="Benefits Paperwork"> Benefits Paperwork<br />
            <input @change="groupCheckboxes($event)" v-model="groupDoc" type="checkbox" name="group_doc" value="Criminal Record Check"> Criminal Record Check<br />
        </div>

I need to limit the selection 2 and if the user decides to change one for another they can without disabling all of them. How would one achieve this?

18 Jun
2 months ago

theUnforgiven left a reply on Getting Users From A Foreach, But Only Sending An Email Once

Thanks, i'll give that a try and yes I'll amend for the users object, as I still need to pass the users to the mailable.

theUnforgiven left a reply on Getting Users From A Foreach, But Only Sending An Email Once

$chats = Conversation::where('group_id', $id)->get();

        $when = now()->addMinutes(5);
        
        foreach($chats as $chat) { 
            $users = User::where('id', $chat->user_id)->get();
            
            foreach($users as $key => $user) {
                $u = collect($user->email);
                \Mail::to($u)
                    ->later($when, new ConversationTranscript($users, $chats, $group));
            }

        }

        return back();

Is the full block of code, then I have the following Conversation table which is where the user thing comes into play:

As you'll see there's two different users there, so basically I just want to get each of the users within any one conversation, sometimes there maybe more than 2, then get that user and their email to fire of the ConversationTranscript mailable only once.

theUnforgiven left a reply on Getting Users From A Foreach, But Only Sending An Email Once

The $chat->user_id comes from a different table and in the example there is two users within this chat one with id 105 and the other 107, so the foreach as two users, but the Mail::to send the email twice to each user, I only want it to send once.

theUnforgiven started a new conversation Getting Users From A Foreach, But Only Sending An Email Once

Hi all, Hope everyone is having a good start to the week.

I have a small hurdle I'm trying to overcome. I have a foreach loop to grab users and then I want each user to receive an email, but only once, whereas in the current code (below) it obviously sends it multiple times.

$users = User::where('id', $chat->user_id)->get();
            
foreach($users as $key => $user) {
     
     \Mail::to($user->email)
              ->later($when, new ConversationTranscript($users, $chats, $group));
}
13 Jun
2 months ago

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

But then how would the rest of the repsonse be rendered in that case?

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

No that doesn't work either and i don't particularly want to go down that road, what I have setup already does work 90%

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

That just shows Cannot read property 'message' of undefined

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

No, I don't think that will work, as I push the response into this array also.

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

My data obj is:

data() {
            return {
                group_id: this.group.id,
                conversations: [],
                typing: false,
                user: '',
                message: '',
                groups: []
            }
        },

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

It seems that after playing around again for a couple of hours, it's something to do with Authorization on the channels.php class.

Or maybe something else, i've missed not sure!!!

But The conversation list shows now, typing indicator still doesn't and the input doesn't clear either, but again think this is linked to the same problem.

I've just tried again to got the following error

[Vue warn]: Error in render: "TypeError: Cannot read property 'account_type' of undefined"

found in

---> <GroupChat> at resources/assets/js/laravel/components/GroupChat.vue
       <Groups> at resources/assets/js/laravel/components/Groups.vue
         <Root>

Which relates to this piece of code:

<div class="panel-body chat-panel">
                                <ul class="list-unstyled">
                                    <li class="media" v-for="(conversation,index) in conversations" :key="index">
                                        <i class="far fa-user mr-3 img-thumbnail"></i>
                                        <div class="media-body">
                                            <h5 class="mt-0 mb-1">{{ user }} ({{ conversation.user.account_type | capitalize }})</h5>
                                            <p>
                                                {{ conversation.message }}<br />
                                                <small class="text-muted pt-1">{{ conversation.created_at | formatDate }}</small>
                                            </p>
                                        </div>
                                    </li>
                                </ul>
                                <span v-show="typing" class="help-block" style="font-style: italic;">
                                    {{ user.name }} is typing...
                                </span>
                            </div>

Which comes from the GET response which does have all the user details in etc, so not sure why it's not rendering.

Which you can see from the response in the network tab:

created_at: "2019-06-13 12:16:57"
group_id: 127
id: 363
message: "skjdhff"
updated_at: "2019-06-13 12:16:57"
user: {id: 126, membership_number: "SBM02101925", title: null, name: "Del Trotter", ema...

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

I'm still having issues with the typing indicator and the message not clearing and updating in realtime, even though as you can see from the last image I posted, Pusher is been notified so this obviously as something to do with the Vue file, but I'm unsure as to what.

12 Jun
2 months ago

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Pusher is showing typing indicator and the message, but the chat isn't updating in realtime, i did forgot to run queue:listen, but that's made no difference :)

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Yes this is true, been trying for the past 2 hrs lol

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Nope and the message isn't been pushed into the list and the input isn't been emptied after submitting either, really weird this.

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

isTyping() {
                let channel = Echo.private('groups.' + this.group.id);
                this.typing = true // set to true here
                setTimeout(function() {
                    channel.whisper('typing', {
                        user: Laravel.userName,
                        typing: true
                    });
                }, 3500);

                
            },

And nothing and yes removed ()

<input
                                        type="text" 
                                        class="form-control input-sm chat-input" 
                                        placeholder="Type your message here..." 
                                        v-model="message" 
                                        @keyup.enter="store" 
                                        @keydown="isTyping" 
                                    >
                                    <span class="input-group-btn">
                                        <button class="btn btn-success" 
                                                style="border-radius: 0px 10px 10px 0px!important;" 
                                                @click.prevent="store"
                                        >
                                        <i class="far fa-paper-plane"></i> Send
                                        </button>
                                    </span>

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

isTyping method also is set oto true:

isTyping() {
                let channel = Echo.private('groups.' + this.group.id);
                
                setTimeout(function() {
                    channel.whisper('typing', {
                        user: Laravel.userName,
                        typing: true // true here
                    });
                }, 3500);
            },

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Ok, added that, but still nothing, also I have in the store method

store() {
                axios.post('/conversations', {message: this.message, group_id: this.group.id})
                .then((response) => {
                    
                    this.conversations.push(response.data);
                    this.message = ''; // To empty the message out, but this isn't working either, and doesn't seem to be posting to the server, but checking the network tab I see it is and is 200 response.
                });
            },

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Typing in the input something then opening up dev tools it does then show message:"something" And the isTyping still not working.

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

As for the isTyping I have @keydown="isTyping" on the input

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Yes, I was tinkering around before posting here, but removed both () from both the input and button

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Figured i quickly show that dev tools is open and I can confirm is working and refreshed, but have a look at this screen cast - https://www.dropbox.com/s/ng158s8oxny3s2r/chat.mov?dl=0

Hitting the button for the store method seems to do nothing, but if I check Pusher and the database I can see the typing indicator works and also the message was sent to Pusher and also the db.

theUnforgiven left a reply on Problem With V-model On Message Input & IsTyping Indicator

Anyone willing to help a brother out please? :-)

theUnforgiven started a new conversation Problem With V-model On Message Input & IsTyping Indicator

Hi all,

I have a problem with a v-model on “message” input and isTyping. As the code is quite long I made a gist - https://gist.github.com/lstables/1ffdbe4e2d1c19015862b9398f7024e6

As you can see below. the message is empty and even when I was typing the isTyping is still set to false.

I’m guessing this is because it should be within the groups array, so question is how does one get this working so the typing indicator and message inputs works, as this should be realtime using Pusher, which Pusher is receiving the typing indicator and message, but Vue isn’t doing as it should, obviously my mistake, so hoping you wonderful lot will help me out here :slight_smile:

11 Jun
2 months ago

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

Yeah, my bad bloody thing! Thanks anyhow dude, greatly appreciated for your help :)

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

Think I may have found the problem, arrgghh!!

Just checked the db and this is the JSON that gets saved

[{"id":1,"unit_no":"1","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":2,"unit_no":"2","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":3,"unit_no":"3

Because the col was set to varchar, it's not saved the remaining characters, school boy error.

It works now! OMG not a good start to the day for me :(

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

I tried that also if you look at my original post, which gave me

Uncaught (in promise) SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)

which is why then I wrapped in JSON.stringify

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

![]|(https://imgur.com/HHfqlcA.png) as the payload is only thing I'm interested in.

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

Tried that and results in lots of empty () which isn't right. Upon selecting the block, it should then show unit no and floor for each on in that object.

theUnforgiven left a reply on JSON Into A V-for Select Dropdown [HELP]

@simon1709 - console log for payload is:

{"id":1,"unit_no":"1","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":2,"unit_no":"2","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":3,"unit_no":"3

theUnforgiven started a new conversation JSON Into A V-for Select Dropdown [HELP]

I have the following from a JSON get request:

units:Array[1]
0:"{"id":1,"unit_no":"1","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":2,"unit_no":"2","floor":"1","landlord":"hghg","landlord_email":"[email protected]","agent":null,"agent_email":null},{"id":3,"unit_no":"3"....

I now want to add the unit_no and floor in a v-for loop within a select.

But the following doesn't work

<select v-model="unitSelection" class="form-control">
      <option>Please select</option>             
      <option v-for="unit in units" :value="unit.id" :key="unit.id">
              {{ unit.unit_no }} ({{ unit.floor }})
      </option>
</select>

I have a select before this which then triggers this select I'm talking about, the method for that is as follows:

getBlocks(event) {
                axios.get('/block/api/getByBlock/' + this.block)
                    .then((response) => {
                        let str = response.data.payload;
                        let payload = JSON.parse(JSON.stringify(str.replace(/[[\]]/g,'')));

                        console.log(payload);
                        this.units.push(payload);
                    });
            },

Where am I going wrong?

10 Jun
2 months ago

theUnforgiven left a reply on Passing Vue Arrays To Laravel

Oh yes, I know it is, it's just that transition from using jQuery for so long to something new.