chaudigv

Member Since 4 Months Ago

Experience Points
43,670
Total
Experience

1,330 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
63
Lessons
Completed
Best Reply Awards
55
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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 9
43,670 XP
Apr
11
7 hours ago
Activity icon

Replied to Create A Migration To Change A Data Type From A String To A Double

Generate a migration

// add appropriate column and table name

php artisan make:migration UpdatePriceColumnToDoubleInInventoryTable
Schema::table('inventories', function (Blueprint $table) {
    $table->double('price', 10, 2)->change();
});
Activity icon

Replied to Cannot Open 'Laravel 8 From Scratch' Free Episodes

Open your question, there's are ... dots under your question's bottom left section. Click and select Edit, then just like you selected General and for this question Feedback, that's where you can update the category of the question.

Also, I would suggest not to select my first response as an accepted answer since it hasn't actually resolved your problem. That was more of a info kind of response.

Activity icon

Awarded Best Reply on Cannot Open 'Laravel 8 From Scratch' Free Episodes

Just adding a link to your previous thread https://laracasts.com/discuss/channels/general-discussion/cannot-open-free-episodes-courses so others can see what strategies are already discussed.

Also, instead of asking a new question, you could have simply updated the category.

Activity icon

Replied to Send Mail On Error In Laravel 8

I can see

vendor/symfony/debug/Exception/FlattenException.php

vendor/symfony/error-handler/Exception/FlattenException.php

Did you upgraded from 6 to 8 directly? I suggest to follow upgrade guide from 6 to 7 and then from 7 to 8 just so you don't skip any important changes.

Activity icon

Replied to Cannot Open 'Laravel 8 From Scratch' Free Episodes

Just adding a link to your previous thread https://laracasts.com/discuss/channels/general-discussion/cannot-open-free-episodes-courses so others can see what strategies are already discussed.

Also, instead of asking a new question, you could have simply updated the category.

Activity icon

Replied to First Or Create Problem

Does DB has firstOrCreate?

I don't think so. Didn't find it in the docs.

Activity icon

Replied to UrlGenerator Not Using App Url In Email Verification

issue got solved guys!

Please share the solution. So others facing the same problem can benefit from it.

Activity icon

Replied to First Or Create Problem

I haven't seen examples of multiple inserts with firstOrCreate. I suggest to pass single array.

Since there will be multiple insert queries, I recommend to use it under DB transaction.

Activity icon

Replied to 419 Page Expired When POST /register

Happens only sometimes

Maybe your session expired. Do you have sufficient time added to SESSION_LIFETIME?

Also, checkout https://laracasts.com/discuss?q=419+Page+Expired There are about 20+ threads.

Apr
10
1 day ago
Activity icon

Replied to Livewire Click Event Not Working

suddenly it stop working

Are you seeing any console errors? Maybe you forgot to force push new assets?

Activity icon

Replied to Laravel/jetstream Window Limited Vertically

Are you using Tailwind, Bootstrap or plain css? Also, please add relevant code or at least a link to the image.

Activity icon

Replied to How To Divide String As Per Requirement?

This is how I would do it. Split the string by space.

$descArray = explode(' ', $description);

Then I would chunk and loop through.

$sentenceLimit = 20;

foreach(array_chunk($descArray, $sentenceLimit) as $line) {
    echo "<p>" . implode(' ', $line) . "</p>";
}
Activity icon

Replied to Laravel | File Exists - Check In Controller

From looking at your code $photo->storeAs('public/photos/', $filename), shouldn't it be $photo->storeAs('public/photos/', $tmp_name)

Activity icon

Replied to About Notification Queues

When the job fails, it goes to failed_jobs table with the error mentioned in exception column. What does your exception says?

Activity icon

Replied to About Notification Queues

Have you updated QUEUE_CONNECTION=database in your .env file?

Activity icon

Replied to Store Unchecked State Of Checkbox

@michaloravec I saw the level of @rokka, seeing the question is quite basic and a simple google search would have been sufficient to reach to a solution. The fact that he didn't do his research shows that he/she is a beginner and looking for a simple answer that doesn't require any further explanation.

As far as it comes to obviously people don't want to write a better code, like @chaudigv, from my perspective every person is growing. Learning and then re-learning is what makes a person better. So rather than saying "obviously", a good way to communicate would have been to tag respective persons and say "This is much shorter and clever". That's it.

There have been multiple cases where my answers were much efficient than the accepted one. That doesn't give me the right to put the person on pedestal.

I hope my response didn't cross any boundries, I am here on Laracasts to learn from others, especially from experienced developers like you.

Activity icon

Awarded Best Reply on Store Unchecked State Of Checkbox

Unchecked is not passed in the request. You will have to check for it's existence

if($request->has('is_deletion_required')) {
	$computer->is_deletion_required = true;
} else {
	$computer->is_deletion_required = false;
}
Activity icon

Replied to Store Unchecked State Of Checkbox

Unchecked is not passed in the request. You will have to check for it's existence

if($request->has('is_deletion_required')) {
	$computer->is_deletion_required = true;
} else {
	$computer->is_deletion_required = false;
}
Activity icon

Replied to Add Condition Along With Pagination For One To Many Relationsip.

Try with whereHas()

->whereHas('posts', function($q) {
	$q->where('status', 'publish')
		->whereDate('post_date','2021-03-03');
	})
->with('posts')
Activity icon

Replied to Fetching Many Records From Database

Can't say I strongly agree without deeper analysis. As long as it solves your performance issues then it should be okay.

Apr
09
2 days ago
Activity icon

Replied to Test Fails When Running All Test

First, do not use env directly rather use it via config. Second, just to confirm that's the issue, use a valid fixed value for samaccountname and password and see if the issue persist when running all tests.

Activity icon

Replied to Displaying Long Text With Laravel Blade

Have you tried displaying with unescaped data?

{!! $description !!}

Or display in textarea but keep it readonly.

Activity icon

Replied to Structuring Database Table That Needs Approval For Each Update

To keep it simple, this is same as a status field i.e. active, banned, pending.

Having appropriate where condition will fulfill your requirements.

Activity icon

Replied to Laravel Pagination OnEachSide Is Not Working

Shouldn't it be {{ $users->onEachSide(2)->links() }}?

Activity icon

Replied to Fetching Many Records From Database

Your skip() and take() stategy will work it's just that you will have to keep track of 2 params i.e as you mentioned a starting point and how much. In pagination() or simplePagination() you just need to pass 1 param i.e. page.

will it scale good with number of users growing

I suggest to seed about a million data and see how the performance is affecting.

Activity icon

Awarded Best Reply on Get Request Client Url In Laravel

Why not pass that as a param in the request?

Activity icon

Replied to Laravel, AWS S3 “Access Denied” Private Access

Did you also specify AWS_DEFAULT_REGION and AWS_BUCKET?

Activity icon

Replied to Laravel, AWS S3 “Access Denied” Private Access

@trav You will need to create a user under AWS IAM. Give that user s3 full access.

Take the user's key_id and secret and add it to your .env file.

Activity icon

Replied to Get Request Client Url In Laravel

Why not pass that as a param in the request?

Activity icon

Replied to Fetching Many Records From Database

Couple of points to consider when building a search/filter + on scroll load more.

  • Use Simple Pagination: If you are not displaying total number of records and number of pages, then ->simplePaginate(15);method to perform a single, efficient query.

  • Indexing: Whatever field you are searching/filtering with, make sure you have proper indexing on it. I recommend checking out Jonathan Reinink's article.

  • Select only the columns that you need. Doing select * is just gonna consume more memory.

Activity icon

Replied to Laravel And VueJS.

Are you using vue-router?

Activity icon

Replied to Get Request Client Url In Laravel

Have you tried?

request()->fullUrl();
Activity icon

Replied to Laravel How To Redirect Second Last Page

If you are certain that after updating you are suppose to go to a fixed view irrespective of the what the second last page could be, then a basic redirect('/list') would suffice.

Activity icon

Replied to Remove Key From Map Collect Method ?

You can use makeHidden()

if ($item['layout'] === "section") {
	$item = collect($item)->makeHidden(['layout'])->toArray();
}

return $item;

or

Use Arr::forget()

use Illuminate\Support\Arr;

if ($item['layout'] === "section") {
	Arr::forget($item, 'layout');
}
Apr
08
3 days ago
Activity icon

Awarded Best Reply on Generate Unique Number On Insert

I would suggest to use created() Observer. That way every time you create a new computer you don't have to mention serial_number every time. Observer will take care of it.

php artisan make:observer ComputerObserver --model=Computer
class ComputerObserver
{
    public function created(Computer $computer)
    {
        $computer->serial_number = generate();
    }
}

You may register observers in the boot method of your application's App\Providers\EventServiceProvider service provider.

Activity icon

Awarded Best Reply on Reset Input Field After 1 Min From Last Typed Character

You will have to play a bit with event listeners.

<input type="password" wire:model="old_password">
<input type="password" wire:model="new_password">
<input type="password" wire:model="password_confirmation">

<button hidden x-on:click='$wire.set("old_password", ""); $wire.set("new_password", "")' id="resetFields">

<script>
    var resetInput;
    window.addEventListener('resetInput', event => {
        if(event.detail == "resetFields") {
            clearTimeout(resetInput);
            resetInput = setTimeout(function(){ document.getElementById("resetFields").click(); }, 60*1000);
        }
    })
</script>
    public function updated() {
        $this->dispatchBrowserEvent('resetInput', 'resetFields');
    }
Activity icon

Replied to Reset Input Field After 1 Min From Last Typed Character

You will have to play a bit with event listeners.

<input type="password" wire:model="old_password">
<input type="password" wire:model="new_password">
<input type="password" wire:model="password_confirmation">

<button hidden x-on:click='$wire.set("old_password", ""); $wire.set("new_password", "")' id="resetFields">

<script>
    var resetInput;
    window.addEventListener('resetInput', event => {
        if(event.detail == "resetFields") {
            clearTimeout(resetInput);
            resetInput = setTimeout(function(){ document.getElementById("resetFields").click(); }, 60*1000);
        }
    })
</script>
    public function updated() {
        $this->dispatchBrowserEvent('resetInput', 'resetFields');
    }
Activity icon

Replied to Laravel Queue Getting Duplicate Values

Is there any way not to stop overlapping until a queue gets over?

Have a look at Preventing Job Overlaps

Activity icon

Replied to What's Wrong With This

Or

$room = new Room;

$room->user_id = $request->input('user_id');
$room->name = $request->input('name');
$room->ability = $request->input('ability');

$room->save();
Activity icon

Replied to Displaying An Array In Command Line

Have you tried ->toArray()?

Activity icon

Replied to Laravel Queue

Once the queue:work command has started, it will continue to run until it is manually stopped or you close your terminal.

Activity icon

Replied to If A Database Operations Fails, How To Log The Failed SQL Querry?

For any database operations I add those chunk of code under a try/catch.

use Illuminate\Support\Facades\Log;

try {
	// queries
} catch (Exception $e) {
	// this message will include all the relevant information
	Log::error($e->getMessage());
}
Activity icon

Awarded Best Reply on Bootstrap Carousel Horizontal Gray Bar On The Bottom

Try adding container-fluid

<div class="carousel-inner container-fluid">
Activity icon

Replied to Bind URL Param To Vue.js

If you are building a SPA then I recommend to use vue-router.

// maybe you are looping then pass the appropriate value
<router-link to="/city/value">click here</router-link>

If you are relying on web.php routes then you can simply do

<a href="{{ url('/city/' . $luxor) }}">click here</a>
Activity icon

Replied to Issue Using VueJS On A Fresh Laravel 8 Installation

@mrkarma4ya Which vue.js version are you using?

Apr
07
4 days ago
Activity icon

Replied to Why Do I Need To Compile Bootstrap Instead Of Using The CDN In Laravel

With Laravel UI there are 3 basic scaffolding that you can choose from. These front-end scaffolding wil be added to package.json file with Bootstrap CSS framework. You are not required to use the Bootstrap framework to build your Laravel application - it is provided as a good starting point for those who choose to use it.

You can remove Bootstrap css from the package.json file and re-run npm install and use CDN instead.

One vital reason to keep such framework in package.json file is so that when I want to update my dependencies, I can simpy run npm update and that will update to latest versions. With CDN you will have to do it manually.

Activity icon

Replied to LiveWire Live Actions Question

when i press success want to make toggle success(green) not success(red)

Could you please explain this. How are you planning to toggle the state?

Activity icon

Replied to Disable Register POST Route

Are you using any scaffolding or custom registration?

My go to solution would be to add a middleware on the reigtser route which check the users count.