theUnforgiven

theUnforgiven

Web Developer at NRS

Member Since 6 Years Ago

UK

Experience Points
302,350
Total
Experience

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

Level 50
302,350 XP
Sep
17
4 days ago
Activity icon

Started a new Conversation AWS SES Problem

Hi all,

I'm having a nightmare with SES and I keep getting the following error message:

Errors: Error executing "SendRawEmail" on "https://email.eu-west-2.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.eu-west-2.amazonaws.com` resulted in a `400 Bad Request` response:
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
  <Error>
    <Type>Sender</Type>
    <Code>InvalidPara (truncated...)
 InvalidParameterValue (client): Header section too long. - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
  <Error>
    <Type>Sender</Type>
    <Code>InvalidParameterValue</Code>
    <Message>Header section too long.</Message>
  </Error>
  <RequestId>502f7901-1ddc-421d-b77c-742f05345d01</RequestId>
</ErrorResponse>

I've got the SES all setup and everything is green in terms of verification etc within my AWS account. MAIL_DRIVER=ses is set

I have the following in the services and .env:

// Services.php

'ses' => [
        'key' => env('SES_KEY'),
        'secret' => env('SES_KEY_SECRET'),
        'region' => env('SES_REGION'),
    ],


// Env
SES_KEY=xxxx
SES_KEY_SECRET=xxxx
SES_REGION="eu-west-2"

But still this fails to work, anyone know how and why?

Many thanks in advance.

Aug
20
1 month ago
Activity icon

Replied to Checking Dates In Two Different Tables

@ravish Hey, thanks for that, yeah maybe that is it I did know about the diffInDays method, just was unsure whether that is what I needed, but now seeing it, I think it may be. 😁

Activity icon

Started a new Conversation Checking Dates In Two Different Tables

Hi,

I have two tables in my database; one called payments and one called details. In the payments table there is date field, I want to check if that date given matches the due_date in the details field within the details table.

I also need to check if the date in the payments table is within 2 days, 7 days and 30 days of the due_date in the details field within the details table.

Both models I have setup date & due_date as Carbon instances too. I'm just a little unsure on what terminology to use to get what I need.

I have the relationship setup as belongsTo in the Payments tbl & hasMany in the Details tbl and I have the following code which does so everything, it's just how does one do the above in a foreach loop and get the required results.

$rentDetails = RentPayments::with('detail')->latest()->where('tenancy_id', '=', user()->tenancy->id)->get();

I just need a foreach loop to iterate other these and should any of the 'filters' match then set a background color on the td of the HTML table it's currently within.

Aug
17
1 month ago
Activity icon

Replied to Saving Different Sections Using Vuex In Nuxt App

Does anyone have any suggestions/ideas on this please?

Aug
15
1 month ago
Activity icon

Started a new Conversation Saving Different Sections Using Vuex In Nuxt App

Hi all,

I hope everyone as had a good week :)

I have a Nuxt app I'm building and it uses an accordion which displays info in a v-for from my Laravel backend. I wish to know how to set the question and answer the user provides using VueX so it will store the answers even if the user isn't online.

I have the following:

<div v-for="(question, index) in section.questions" :key="index">
    <p class="p-1">
        <span v-if="question.required == 1"><small class="text-danger">*</small></span>
        {{ question.label }}
    </p>
    <component :is="question.type" :question="question" />
</div>

The dynamic component <component :is="question.type" :question="question" /> just renders different form elements; i.e input, select, radio etc, and it's these answer the user provides that I'm not sure on how best to save them in each section as the questions are split up into about 6/7 different sections.

I hope this makes sense and someone can help me get a solution or give me some guidance on how to use Vuex based on what I've hopefully explained.

Aug
14
1 month ago
Activity icon

Replied to Vue Radio Buttons Problem

Yes you were right, needed to be the same name, all good now thank you.

Activity icon

Replied to Vue Radio Buttons Problem

@piljac1 Yes I changed that to be just v-model="selected" but still I can only select the first one, it doesn't allow me to select the 2nd or any other option for that matter.

Here's an updated version:

<input class="custom-control-input"
                        type="radio"
                        :id="'question_' + question.id"
                        :name="option"
                        :value="option"
                        v-model="selected"
                        @change="update($event)"
                    >
                    <label class="custom-control-label" :for="'question_' + question.id">
                        {{ option }}
                    </label>
Aug
13
1 month ago
Activity icon

Replied to Vue Radio Buttons Problem

Anyone know the answer please?

Activity icon

Replied to Vue Radio Buttons Problem

I'm using Vue's dynamic components to render which form element type needs to be rendered based on what comes from the DB.

Activity icon

Started a new Conversation Vue Radio Buttons Problem

Hi all,

I have the following:

<label class="label-control">{{ question.label }}</label>
<div v-for="(option, index) in question.options" :key="index">
    <div class="custom-control custom-radio">
        <input class="custom-control-input"
            type="radio"
            :id="question.id"
            :name="'question_' + question.id"
            :key="index"
            :value="option"
            v-model="selected[index]"
        >
        <label class="custom-control-label" :for="question.id">
            {{ option }}
        </label>
    </div>
</div>

Which produces

Each question as different answers, but I'm not sure the above code is correct, as I can only select one option and doesn't change when I try select something else.

I also don't know how to store the question and answer into an array so I can send it to my Laravel backend to save this. Any help greatly appreciated.

Aug
09
1 month ago
Activity icon

Replied to Decypher This...

It looks like I was trying to encode it twice, again my bad so with that in mind, I'm going to leave it now it's working and eat then hopefully get some sleep lol

But thanks again for trying to help me, greatly appreciated.

Activity icon

Replied to Decypher This...

That I had, but I was getting an error, but changed how it saves to the db and now working OMG ....Sorry @sinnbeck I've totally wasted your time...Think I need food and sleep!

Activity icon

Replied to Decypher This...

Ideally, I want a HTML for fees and one for fines, just can't for the life of me remember how to do it based on what I posted that is returned.

Activity icon

Replied to Decypher This...

yeah, sorry my bad, i should have said

Activity icon

Replied to Decypher This...

json decoding {"fees":[{"item":"Admin Fee","fee":"25"}],"fines":[],"vat_reg":false,"prices_ex_vat":false,"management_perc":"%","management_fee":"10","tenant_fee_desc":null,"tenant_fee":null,"vat_number":null,"feeSymbol":"%","tenantSymbol":null,"otherTenantFees":null} that kinda works but I can't seem to foreach it

Activity icon

Replied to Decypher This...

Yes, kinda the reason why it's been done in one field in the database tbh.

Activity icon

Replied to Decypher This...

Just easier to maintain in one table as it's saved from Vue component really.

Yeah got one at 15 and 1 yr old as of Friday.... lol

Activity icon

Started a new Conversation Decypher This...

Sorry, I'm running on 10 mins sleep in like 30 hours now, thanks to my lovely 1 year old...However I'm having a brain freeze...

I have this as a collection:

 #items: array:1 [▼
    0 => "{"fees":[{"item":"Admin Fee","fee":"25"}],"fines":[],"vat_reg":false,"prices_ex_vat":false,"management_perc":"%","management_fee":"10","tenant_fee_desc":null,"tenant_fee":null,"vat_number":null,"feeSymbol":"%","tenantSymbol":null,"otherTenantFees":null} ◀"
  ]

How does one get this so it can be displayed nicely in a table?

Aug
06
1 month ago
Activity icon

Replied to Converting An Include From Laravel To Vue

Interesting, i think i can make something of that, thank you

Activity icon

Started a new Conversation Converting An Include From Laravel To Vue

Hi all,

I have this in Laravel:

@foreach($section->questions->sortBy('order') as $question)
      @include('feedback.questions.' . $question->type, compact('question'))
@endforeach

I need to convert this into Vue, so the foreach is fine I've done that and that works, however I could do with adding on the sortBy() in vue and then including a vue template that will render which ever type is passed for form elements, like checkbox.vue, label.vue etc

How would one achieve such task....?

Jul
20
2 months ago
Activity icon

Replied to PDF To HTML Conversion

Anyone else have any suggestions please?

Jul
19
2 months ago
Activity icon

Replied to PDF To HTML Conversion

Haha yeah no worries

Activity icon

Replied to PDF To HTML Conversion

Sure these are html to pdf? I want the inverse.

Activity icon

Started a new Conversation PDF To HTML Conversion

Is there a package or simple helper to convert any form of PDF to HTML (not the other way, html to PDF)

I did use a package which seems to be no longer maintained and is now broken. Any help/advice greatly appreciated.

Jul
13
2 months ago
Activity icon

Replied to Uploading API URL File To AWS S3

You could try something like:

Storage::disk('s3')->put('img/carimages/' . $imgname, $image, 'public');

This would store on S3 if you have everything set within your env file.

Jul
12
2 months ago
Activity icon

Replied to Get Users Via Pivot

Then also a user can have a tenancy and that tenancy have a property all of which have a relation in some respect. So its like have 3/4 tables all related.

Activity icon

Replied to Get Users Via Pivot

I think a hasManyThrough would be the answer, just unsure to how and what I need to reference based on my tables.

Activity icon

Started a new Conversation Get Users Via Pivot

Hi all,

Hope everyone is having a good weekend.

I'm not sure how to achieve the following, so help greatly appreciated.

I have a Users table & a Companies table, these are related by a company_user pivot table which houses the company_id and user_id.

I need to get the relationship(s) from the company ,but that company could be a parent and/or belong to another parent, and both parents can have children, plus I only want to get a specific type, based on the account_type from the user's table (i.e tenants).

How is this possible and what can I do to achieve such complex relationships?

Thanks in advanced.

Jul
08
2 months ago
Activity icon

Replied to Dates In For Loop Issue!

Damn! Yeah why not (smacks head and buries in ground)

Activity icon

Started a new Conversation Dates In For Loop Issue!

If I specify the start date as 2020-07-01 I want that to go in the loop also, and then finish the loop when it hits the end date given, say in 6 months time..

for ($i = 0; $i <= $duration; $i++) {
    Commitment::create([
        'user_id' => 270,
        'tenancy_id' => 108,
        'dates' => $i == $duration ? $end->toDateString() : $start->addMonths($i)->toDateString()
    ]);
}

here's what I extracted from the db as JSON, so right in the sense, but would need to also add the start date one too.

[
  {
    "id": 127,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-08-01 00:00:00",
    "month": 0
  },
  {
    "id": 128,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-09-01 00:00:00",
    "month": 0
  },
  {
    "id": 129,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-10-01 00:00:00",
    "month": 0
  },
  {
    "id": 130,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-11-01 00:00:00",
    "month": 0
  },
  {
    "id": 131,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-12-01 00:00:00",
    "month": 0
  }
]
Activity icon

Replied to Date Incrementing Based On Given Date

Does anyone have any more suggestions on how I achieve such task please :)

Jul
07
2 months ago
Activity icon

Replied to Date Incrementing Based On Given Date

Although this seemed right at the time, it's actually not:

If I specify the start date as 2020-07-01 I want that to go in the loop also, and then finish the loop when it hits the end date given, say in 6 months time..

here's what I extracted from the db as JSON, so right in the sense, but would need to also add the start date one too.

[
  {
    "id": 127,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-08-01 00:00:00",
    "month": 0
  },
  {
    "id": 128,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-09-01 00:00:00",
    "month": 0
  },
  {
    "id": 129,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-10-01 00:00:00",
    "month": 0
  },
  {
    "id": 130,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-11-01 00:00:00",
    "month": 0
  },
  {
    "id": 131,
    "user_id": 129,
    "tenancy_id": 59,
    "dates": "2020-12-01 00:00:00",
    "month": 0
  }
]
Jul
02
2 months ago
Activity icon

Replied to Sending To Other ID Within One Column...[Assistance]

@frankielee I believe this was you. Feel free to say so and I can give you credit for it.

Activity icon

Replied to Sending To Other ID Within One Column...[Assistance]

$re = Feedback::where('recipient_id', '!=', user()->id)->pluck('recipient_id')->first();
$user = User::where('id', $re)->first();
$user->notify((new FeedbackCompleted($feedback))->delay($when));

Works a treat, someone did post a similar solution, but for some reason it's not displayed but I got the email.

Activity icon

Started a new Conversation Sending To Other ID Within One Column...[Assistance]

Hi all,

I'm sure there's a way to do this, but can't for the life of me think what/how.

I have a bunch of different IDs in a recipient column within the database.

I want to send a notification to the other party, so if logged in user is 143 then I want to be able to send the notification to 270 and vice versa. How can this be done with ease...?

Jun
27
2 months ago
Activity icon

Commented on Transitions 101

@JeffreyWay - Are you planning on showing us how to use Alpine for a reusable Modal window?

Jun
25
2 months ago
Activity icon

Replied to Livewire Help Relationships

Scratch that....figured it out...

I was using factories to seed the database and there was some ID's that didn;'t tally up...omg it's been a long hot day here in the UK, forgive me :)

Activity icon

Started a new Conversation Livewire Help Relationships

Hi all,

I have the following code in my Livewire component:

$tasks = Tasks::with('user')->where('owner_id', auth()->user()->id)->get();

        foreach($tasks as $task) {
            dd($task->user->name);
        }

dd($task->user->name); shows the user's name, however....

Comment that out and do:

 return view('livewire.tasks.all', [
            'tasks' => Tasks::with('user')->where('owner_id', auth()->user()->id)->paginate(10),
        ]);

Then within my view file I have the foreach:

@foreach($tasks as $task)
	<p>{{ $task->user->name }}</p>
@endforeach

Which shows as a Trying to get property 'name' of non-object any reason why this would be?

Also I have the relationships setup on each the Task and User models.

//User Model

 public function tasks()
    {
        return $this->hasMany(Tasks::class, 'task_owner');
    }


// Task Model

public function user()
    {
        return $this->belongsTo(User::class, 'task_owner');
    }
Jun
24
2 months ago
Activity icon

Replied to Using JS (Vue) In Larvel To Toggle Hamburger Button

Also make sure you have run npm run dev to compile the changes you make and to register the component, if you haven't already.

Activity icon

Replied to Using JS (Vue) In Larvel To Toggle Hamburger Button

Just call the component within your blade file like so:

<menu />

Unless you want to pass something inside then it would be:

<menu>something inside, i.e links otherwise pass props.</menu>
Activity icon

Replied to Date Incrementing Based On Given Date

Sweet, yeh thats it, thank you very much @michaloravec

Activity icon

Started a new Conversation Date Incrementing Based On Given Date

Hi all,

I hope everyone is well & healthy.

I have a small issue, I can't seem to get my around.

Just bashing this out in Tinkerwell for quickness, but it's doing as I want.

$duration = 12;
$start = '2020-06-05';
$end = '2021-06-04';
$diff_in_months = diffInMonths($start,$end);
$date = Carbon\Carbon::now()->addMonth();


for ($i = 0; $i <= $duration; $i++) {
    return Commitment::create([
        'user_id' => 270,
        'tenancy_id' => 108,
        'dates' => $date // This is what I'm struggling with...
    ]);
}

So for each records it should be 12 records or whatever is within the duration, but the dates attribute in the create method should be from the start date and increment the months to the end date. So how would one achieve this so there would be 12 records in the db starting from 2020-06-05 then next record would be 2020-07-05 then 2020-08-05 and so on until the end date of 2021-06-04 in this example.

Thanks in advance and I hope one of you lovely people can help me...

Jun
09
3 months ago
Activity icon

Replied to Quick Vue Question (hopefully)

Yeah decent chocolate too

Activity icon

Replied to Quick Vue Question (hopefully)

Metallica and Maiden lol

Jun
08
3 months ago
Activity icon

Replied to Quick Vue Question (hopefully)

Yes I took your advice and done it from the backend, all is good now and I have more control now.

Activity icon

Replied to Quick Vue Question (hopefully)

9/10 I do from database/backend just in this instance I didn't and don't know why I did it this way, probably just for quickness to get it up and running I guess. But no is the time to change and update it.

Activity icon

Started a new Conversation Quick Vue Question (hopefully)

Hi all, Happy Monday :)

I have a select field

Which is rendered from Vue like so:

<div class="form-group">
                  <label>Select number</label>
                  <select class="form-control" v-model="numberSelection" @change="createBlock" ref="blockSelection">
                  		<option selected="" value="Please Select">Please Select a Block</option>
						<option v-for="item in blockNumber" :value="item" :key="item" :data-url-desc="numberSelection">
						Block {{ item }}
						</option>
                  </select>
              </div>

// Then in the mounted method I get the list from the prop that's passed.

for(let i = 0; i <  this.blocks.number_of_blocks; i++) {
	this.blockNumber = i+1;
}

This gives me what you see in the screen shot, however I want to show within the select only items not flagged as complete which in my database I have an complete column.

My question is how can I do this?

Jun
07
3 months ago
Activity icon

Awarded Best Reply on Livewire/Alpine Modal How To Close Upon Successfully Posting..?

After a quick convo on twitter , I found I needed to do the following:

$this->dispatchBrowserEvent('close-modal');

then on the x-data do :

x-on:close-modal.window="on = false"