Chron

Chron

Member Since 10 Months Ago

Experience Points
11,240
Total
Experience

3,760 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
26
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 3
11,240 XP
Oct
20
2 days ago
Activity icon

Replied to Grab Images To Form A Carousel

Some posts have images in them. I want to grab all those images and put them in a carousel. The images are embedded in the text.

Here's one of the examples:

<!--A post description-->

Duis volutpat pharetra molestie. Maecenas imperdiet tellus vel elit volutpat imperdiet. Nullam dapibus sagittis feugiat. Praesent lobortis maximus massa, sit amet consequat velit volutpat a. 

<img src="lorem-pic.jpg">

I output the post descriptions with {!! $post->description !!}

Oct
19
3 days ago
Activity icon

Started a new Conversation Grab Images To Form A Carousel

Is there a way to grab all the post that has images and put the images in a carousel?

When an image in the carousel was clicked, I want it go to its own post.

//PostController.php
public function index(){
        $posts = Post::with('user')->latest()->get();
        return view('home', compact('posts'));
}
Oct
18
4 days ago
Activity icon

Replied to How To Record Paypal Transaction?

Yes, that's what I thought at first but is it okay though?

Activity icon

Replied to Make A Carousel From Posts

Thank you for replying. I don't have a problem with grabbing all the posts that has images. The only problem is how can I link those images to their respective posts.

Oct
17
5 days ago
Activity icon

Started a new Conversation Make A Carousel From Posts

Is there a way to grab all the posts that has images in them and make a carousel from that? And when I clicked an image in a carousel, I'll get redirected to its post.

Oct
14
1 week ago
Activity icon

Started a new Conversation How To Record Paypal Transaction?

The paypal button is rendered by the paypal checkout js. Should I just make my own CRUD or should I use this and use the paypal php package?

https://justlaravel.com/paypal-payment-gateway-integration-laravel/

Oct
11
1 week ago
Activity icon

Started a new Conversation Paypal Backend

The paypal button is rendered by the paypal checkout js. The transaction is fully functional just minus the recording of transaction.

Is it okay to just use a regular CRUD? Or use the paypal package like the one they did here?

https://justlaravel.com/paypal-payment-gateway-integration-laravel/

Activity icon

Replied to Use Env Variable Into Script Tag

It worked. Thanks :)

Activity icon

Replied to Use Env Variable Into Script Tag

I tried doing it.

CLIENT_ID=XXXXXXXXXX

MIX_CLIENT_ID="${CLIENT_ID}"
<script src="https://api.com/client-id={process.env.MIX_CLIENT_ID}"></script>

But it just hardcoded it.

Activity icon

Started a new Conversation Use Env Variable Into Script Tag

is there a way to use env variable inside a script tag?

.env

CLIENT_ID = XXXXXXXXXXXXXXXXX

master.blade.php

<script src="api.com/client_id=CLIENT_ID">
Oct
07
2 weeks ago
Activity icon

Started a new Conversation Comparing Arrays

How can I compare arrays?

I want to compare if the values of $a exist in $b.

$a = [1,2,3];

$b = [1,2,5,6];

I can easily do it by using in_array but is there any other solution without using any loops?

Oct
06
2 weeks ago
Activity icon

Replied to Uploading Project In A Shared Hosting

Do I have to clean the project first like running certain commands before I upload it? Because I have no access to the ssh.

Oct
04
2 weeks ago
Activity icon

Started a new Conversation Uploading Project In A Shared Hosting

What would be the best way to upload project in a shared hosting? I have an account but no ssh access.

Sep
28
3 weeks ago
Activity icon

Replied to Adding Constraint In Relationships?

Oh, I'm very sorry for that. I'll just change the best answer. Thank you for helping. Again, I'm very sorry.

Activity icon

Replied to Nested Condition

It can be achieved by referencing the actual table.

Brand::with('toys.children')->whereHas('toys.children', function($q){
    $q->where('children.toy_id', null);
})->get();

//or

Brand::with('toys.children')->whereHas('toys.children', function($q){
    $q->whereNull('children.toy_id);
})->get();
Activity icon

Replied to Adding Constraint In Relationships?

Ohh. But I'm still getting an empty collection of unownedToy when the toy has been owned. How can I fix that??

Activity icon

Replied to Adding Constraint In Relationships?

yes, maybe chaining isn't a good idea but this..

public function unownedToy()
    {
        return $this->belongsTo(Toy::class)->whereNull('child_id');
    }

Just throws an empty collection.

Sep
27
3 weeks ago
Activity icon

Started a new Conversation Grab Only If Relationship Is Not Empty

Store::with('brands.unownedToy')->has('brands.unownedToy')->get()

Brand.php

public function unownedToy()
    {
        return $this->toy()->whereNull('child_id');
    }

public function toy()
    {
        return $this->belongsTo(Toy::class);
    }

I get the toys that are not owned yet, but I'm getting an empty collection of unownedToy when the toy has been owned. How can I fix that?

Activity icon

Replied to Adding Constraint In Relationships?

So this is my the full query..

Store::with('brands.unownedToy')->has('brand.unownedToy')->get()

I get the toys that are not owned yet, but I'm getting an empty collection of unownedToy when the toy has been owned. How can I remove that?

Activity icon

Replied to Adding Constraint In Relationships?

solved it by doing

public function unownedToy()
    {
        return $this->toy()->whereNull('child_id');
    }

But I just end up with using query builder because when I'm using eloquent, If the child_id isn't null, it will be null when I used the unownedToy and it will still be fetched.

Activity icon

Replied to Adding Constraint In Relationships?

Changed it to singular.

public function unownedToy()
    {
        return $this->belongsTo(Toy::class)->whereNull('child_id');
    }

Still throwing an empty collection of unownedToy

Activity icon

Replied to SortBy WhereIn Array

try adding use($element) after closure in whereHas.

->whereHas('MotorSize', function (Builder $query) use ($element) {
                        $query->where('mounting', '=', $element);
                    })
Activity icon

Replied to Adding Constraint In Relationships?

I added another relationship.

public function unOwnedToys()
    {
        return $this->belongsTo(Toy::class)->whereNull('child_id');
    }

When I intentionally made a mistake, changed child_id to child_i.

I get the the extra condition

select * from `toys` where `child_i` is null and 0 = 1

I'm just getting an empty collection of unOwnedToys.

Activity icon

Replied to Adding Constraint In Relationships?

    public function toys()
    {
        return $this->belongsTo(Toy::class)->whereNull('child_id');
    }
Activity icon

Replied to Adding Constraint In Relationships?

I just tried it.

I'm getting an extra query

select * from `toys` where `child_id` is null and 0 = 1

where did the 0=1 came from?

Activity icon

Replied to Adding Constraint In Relationships?

Can I do it in inverse?

return $this->belongsTo(Model::class)->whereNull('foreign_id');
Sep
26
3 weeks ago
Activity icon

Replied to Adding Constraint In Relationships?

I just fetch it through QB. However, I'm getting the id of I don't know which table. Is there a way to group all the toys and add toy_ prefix? the same with stores and brands

Activity icon

Replied to Adding Constraint In Relationships?

does your query apply to brands or Toys?

only toys

Activity icon

Started a new Conversation Adding Constraint In Relationships?

I want to do it like this.

Store::with('brands.toys', function($q){
    $q->where('child_id', null);
})->get()

I would like to fetch all the toys that doesn't have child_id yet.

Activity icon

Replied to Strange Password In My Database

@k0tkin because the passwords are hashed to make it more secure.

Activity icon

Started a new Conversation Nested Condition

I want to grab all the children that has the toy_id of null.

Here's my code

Brand::with('toys.children')->whereHas('toys.children', function($q){
    $q->where('toy_id', null);
})->get();

I tried this but still getting all children that does have toy_id

Activity icon

Started a new Conversation Undefined Variable In Form Request

is there a way to redirect to a specific resource when the request failed?

i tried using

    protected $redirect;

    public function __construct() {

        $this->redirect = route('post.show', ['post' => $post]);
    }

url()->previous() and return back() just returns to '/'

Sep
25
3 weeks ago
Activity icon

Replied to Fill Does Not Exist

Can I just make it like this?

$this->brand->fill([])

Activity icon

Started a new Conversation Fill Does Not Exist

Here is my code.

if (!is_null($this->brand)) {
            $brand = Brand::find($this->brand);
            $brand->fill([
                'type_id' => request('type')
            ]);

            if($brand->isClean()){
                return true;
            }
        }

I'm getting Method Illuminate\Database\Eloquent\Collection::fill does not exist. error

Sep
24
4 weeks ago
Activity icon

Started a new Conversation Fill And Dirty

when using fill does it save the record?

Activity icon

Replied to Check If The Resource Got Changed

Should I fill the model first then check it if it isDirty() ?

Activity icon

Started a new Conversation Check If The Resource Got Changed

Before storing data, I want to grab all the request first then check if they got changed. Is there a way to do that?

Sep
23
4 weeks ago
Activity icon

Started a new Conversation Opposite Of Model::has('relatedModel')

Do we have methods that behaves opposed to has method ?

Sep
22
1 month ago
Activity icon

Started a new Conversation Route Names

Is there a way or any helpers that can match a route name that has '.show' in it?

Activity icon

Replied to Value That Holds Slot

Undefined variable: multipleDeleteId 
(View: /system/resources/views/layouts/components/buttons.blade.php)
 (View: /system/resources/views/layouts/components/buttons.blade.php)

[Edit] Oh wait.. I have another component that didn't close. That solved it. Thanks!

Activity icon

Replied to Value That Holds Slot

Ohh..But still the same the error.

Activity icon

Replied to Value That Holds Slot

@foreach($brands as $brand)
    @component('layouts.components.buttons')
    @slot('edit')
    {{ route('brand.edit', $brand->id) }}
    @endslot
    @slot('multipleDeleteId')
    {{ $brand->id }}
    @endslot
@endforeach
<!--layouts/components/buttons.blade.php-->
<a href="{{ $edit }}">
    <i class="fa fa-edit"></i>
</a>
<input type="checkbox" name="itemId" value="{{ $multipleDeleteId }}">
Activity icon

Replied to Value That Holds Slot

Still throws the same error.

Activity icon

Replied to Value That Holds Slot

<input type="checkbox" name="itemId" value="{{ $multipleDeleteId }}">

Is part of a component and {{ $multipleDeleteId }} is a slot.

I have

@component('layout.component.component')
@slot('multipleDeleteId', $id)
@endcomponent

But I'm getting undefined variable

Activity icon

Started a new Conversation Value That Holds Slot

is there a way to have a slot in a value attribute?

I tried this..

<input type="checkbox" name="itemId" value="{{ $multipleDeleteId }}">

But I'm getting undefined variable.

Sep
21
1 month ago
Activity icon

Replied to Validation Not Working

I'm not sure if you can access route parameters directly like that.

Yes you can. You can dd it to test it.

Activity icon

Started a new Conversation Validation Not Working

Unique isn't working on update

I have the validations in my form request.

'code' => ['required', 'string', 'unique:toys,code,'.$this->toy->id],
Activity icon

Replied to Updating Records That Has One To Many

I saw this updateOrCreate that may solve my problem but what if the user removed an option? If I just do that query, I will still get the removed option.

Sep
20
1 month ago
Activity icon

Replied to M:N Relationship

@ftiersch

Depends on the relationship. There can still be an entity one without the entity two

Can you please give an example of that?

Activity icon

Replied to How To Access Pivot Table With Pivot Table

@cwinterweb

If it is one to many, then how can I update it if the toy's brand has been changed. The brand is still exist but its toy isn't his anymore because it been given to another brand.