jlrdw

jlrdw

Member Since 4 Years Ago

Experience Points
492,530
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
178
Lessons
Completed
Best Reply Awards
538
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
492,530 XP
Apr
08
15 hours ago
Activity icon

Replied to Scopes

I would not go with just year I would have a time also maybe even down to milliseconds, but it's your choice.

Activity icon

Replied to Can I Upload Text And Image In One Database Column?{Illuminate\Http\Exceptions\PostTooLargeException}

Seems like this has been answered, could you please show it as answered.

Activity icon

Replied to DB Not Working

You have displayed no errors the code that caused this, if you showed errors it will help us help you.

In other words is there more to the error or what were you trying to do.

And show code.

Activity icon

Replied to How Use Custom "model" And "auth" ?

See https://gist.github.com/jimgwhit/ed44a6c81815804f1ab910ce9eb88d84

I use the built-in Authentication however I have custom authorization.

Apr
07
1 day ago
Activity icon

Replied to Error Installing Package

Have you tried manually adding the package info to composer.json instead of require.

Activity icon

Replied to Redirect After Login

Another option is use the authenticated method from the trait and:

    public function authenticated(Request $request, $user)
    {
         return redirect('/todos');
    }

You can also put logic with if statements, check the role, and redirect to admin area if admin, user area if user.

Activity icon

Replied to Laravel Admin Can Access User Account

An old post, start a new topic.

Activity icon

Replied to Redirect After Login

Hard to say what's not working if you made many changes to the built-in Authentication, if you have highly customized it then without your code it's hard to see what's going on.

Activity icon

Replied to A Custom Query Builder To Support With, Filters, Sorting And Pagination

Maybe you should look at one of the datatables implementations. I don't use myself I usually just write my own queries.

Activity icon

Replied to HALP! Laravel Mix Not Using My App.css

Just curious, have you viewed https://laracasts.com/series/laravel-6-from-scratch

Episode 17

It will help. Also just a small suggestion, until you get a handle on this, I'd follow Taylor's instructions. Not knocking other tutorials.

Activity icon

Replied to Switching 2 Values In Database Same Column.

Something like:

if($page = 0) {
    $page = 1;
}else{
    $page = 0;
}

If in blade use blade if construct.

Activity icon

Replied to A Custom Query Builder To Support With, Filters, Sorting And Pagination

Of course some things you have to do yourself, but those past discussions should point you in the correct direction.

As far as 'na' in 'Banana' that's just using like operator.

To get a better grasp on sql and writing various queries I suggest this site:

https://www.mysqltutorial.org/

And like is exampled in the docs:

$users = DB::table('users')
                ->where('name', 'like', 'T%')
                ->get();

Same for numbers between, greater than, less than, all can be done in sql.

You'd be surprised how much you will learn by working the examples that Taylor provided in the documentation.

Activity icon

Replied to Redirect After Login

That should work, have you changed anything else. In my laravel 7 it works, but I have the exact out of the box authentication just like in the docs.

Activity icon

Replied to How To Display Data Value According To Dropdown In Laravel?

In one of Jeffrey's free "from scratch" videos he demos a search by slug instead of id.

Activity icon

Replied to A Custom Query Builder To Support With, Filters, Sorting And Pagination

Done many times: Punch into google

site:laracasts.com eloquent filtering and pagination

Explanation, google search is more powerful than the search here.

Tweak search as needed. And there are past in depth great discussions on this.

Apr
06
2 days ago
Activity icon

Replied to Group By Fetch Only Data Of First Row

Play with this stuff a little bit, you may need a double group by followed by an order by.

Most of these type for queries of some complexity does take a little trial and error.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

Chewy was just an example, but I do it like chewy, FedEx, Amazon, Walmart, any company that generates invoices.

In other words the line items foreign key has to equal their parent id.

But good luck and I hope your Technique works great for you.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

So you related the items like Chewy or any business does:

Line items FK = parents id. Each line item of course has it's unique id.

Activity icon

Replied to Insert Database Rows Into A Txt File

You probably need to use a CSV file.

Activity icon

Replied to The Map Method

@bugsysha yes.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

Look at it like you doing a main invoice.

Main invoice is tied to a customer.

Line items is tied to invoice.

So you could say you have a one-to-many and then another one-to-many.

Don't worry about the line items being tied to a customer, details or line items are tied to the invoice.

When Joe goes and Pulls item 54102, he's not worried about the customer he's worried about that order or invoice.

Let Sally in shipping worry about that order going to the correct customer.

For an example go to chewy and order some dog food and a couple of other items.

One order is created that is tied to you the customer.

The several items you ordered are tied to that main invoice or Main order.

it's really that simple.

Activity icon

Awarded Best Reply on Database Calls More Efficient At Blade View Or Controller?

If you did not want to make a model you can use Query Builder. And indexing search fields will help.

Of course searching a thousand records is going to be faster then searching millions of Records.

Also only query for what you need so you are dealing with a subset of records.

One trick is to archive old records that you may need to save but doesn't apply to a query anymore.

For example I don't need the year 2019 income and expenses in the year 2020 but I do need to Archive and save them.

Activity icon

Awarded Best Reply on Can I Add A Laravel Policy To My Route?

You could write a middleware and make a route group.

Activity icon

Replied to How Can I Delete Old Image While Updating The Post With New Image

@alodon shouldn't you have given @etiennedeschenes the best answer since they are the one that pointed you to unlink. Just an observation.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

Well you didn't read link, so

When you $request->input('whatever'), it's an array.

If you have 4 choices a,b,c,d.

If user selected b,d, then loop, get b.d, store in your related table, or store as json.

Honest, this has been covered many times, either store as related data in a related table or store a json array or a comma separated list.

$testarray = $request->input('whatever');
$mydata = implode(",", $testarray);

Where whatever is your select options.

Store ---- done

only b,d will be in array.

Also see, click link https://stackoverflow.com/questions/47157155/how-to-save-multiple-selection-data-in-laravel

Activity icon

Replied to Beginner: What Is The Best Way To Get Data From Multiple Tables Without Duplication

I usually to have a pop-up table to search with a search form at the top that way I am only pulling the data I need. I like lookup tables better than dropdowns. But of course it's your choice. and laravel has nothing to do with that, you would do similar as regular PHP.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

Yes you only Loop the request for passed items, the select option will be passed as an array, which will hold only the selected items. The other request objects will hold single items such as text fields.

Found one of my previous answers that will answer your question, it's for check boxes but select is siimilar.

https://laracasts.com/discuss/channels/laravel/checkbox-inserts?page=0

Get your data either store in comma separated list or Json or related fields however you desire.

Activity icon

Replied to Update A Related Record

No JavaScript isn't required.

Activity icon

Replied to ::find Only Returns First Entry

You ask for first. Maybe you need to find by key.

Activity icon

Replied to How To Insert Values Of Total_price 0 For Last 30 Days If Is Not Created_at?

Of course if you are talking tens of thousands of Records you could write a database transaction to update that field where null.

Activity icon

Replied to Can I Add A Laravel Policy To My Route?

You could write a middleware and make a route group.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

You have to loop through the request array, and get the selected values.

In fact myself and others have answered this very question, if you punch in Google The Following.

site:laracasts.com save multiple dropdown values

You can store in related fields or you could store as Json. That's up to you.

Apr
05
3 days ago
Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

Did you look at saving related models in the chapter on eloquent relations.

Activity icon

Replied to Database Calls More Efficient At Blade View Or Controller?

If you did not want to make a model you can use Query Builder. And indexing search fields will help.

Of course searching a thousand records is going to be faster then searching millions of Records.

Also only query for what you need so you are dealing with a subset of records.

One trick is to archive old records that you may need to save but doesn't apply to a query anymore.

For example I don't need the year 2019 income and expenses in the year 2020 but I do need to Archive and save them.

Activity icon

Replied to Database Calls More Efficient At Blade View Or Controller?

I would start here and practice writing efficient queries: https://www.mysqltutorial.org/

Make sure you are indexing the needed fields.

It's an MVC framework so I would write a query in the model, in some cases controller, and return results to the view to display.

Are you familiar with aggregate functions.

Activity icon

Replied to Blade Component Render In View Causes "syntax Error, Unexpected 'endif' (T_ENDIF), Expecting End Of File"

Remember sometimes you need to clear cache between program changes. Browser and view. That has got me more than once.

Activity icon

Replied to Static Functions In Controllers? What's The Alternative?

Make a facade or use __callStatic(). But rather than controller I would make this in a helper class or whatever you want to call it.

There is nothing wrong with using static, the very request class that laravel uses has plenty of static methods:

https://github.com/symfony/http-foundation/blob/master/Request.php

Activity icon

Awarded Best Reply on What Happens To Fields Not Guarded But Also Not Specified As Fillable

https://laravel.com/docs/7.x/eloquent#mass-assignment

Read that, it's for people who insist on

$input = $request->all();

Instead of just requesting the needed fields:

$name = $request->input('name');
// and just fields concerned.

It protects from someone changing important data, like a user id.

Scroll on down to Guarding Attributes, it's all covered in docs, just read.

Activity icon

Replied to What Happens To Fields Not Guarded But Also Not Specified As Fillable

You keep asking, how would we know when we don't do that. I just use fillable, and I do what Taylor has put in the docs.

Activity icon

Replied to HALP! Laravel Mix Not Using My App.css

Referring to https://laracasts.com/discuss/channels/vue/registerbladephp-and-loginbladephp-vue-styles-not-applying

I’ll let you know if i see something interesting in the header

The layout header is where this stuff goes.

Activity icon

Replied to What Happens To Fields Not Guarded But Also Not Specified As Fillable

https://laravel.com/docs/7.x/eloquent#mass-assignment

Read that, it's for people who insist on

$input = $request->all();

Instead of just requesting the needed fields:

$name = $request->input('name');
// and just fields concerned.

It protects from someone changing important data, like a user id.

Scroll on down to Guarding Attributes, it's all covered in docs, just read.

Apr
04
4 days ago
Activity icon

Replied to Register.blade.php And Login.blade.php Vue Styles Not Applying

I'm still getting that very basic default css file ...

Okay locate that file and replace it with the correct one.

Activity icon

Replied to Register.blade.php And Login.blade.php Vue Styles Not Applying

Forget all about mix and compiling for a moment, just rename bootstrap.css to app.css, and figure out which folder it belongs in, so you can see the correct css.

Then go back and read the chapter on front end again. You probably missed some little detail.

Activity icon

Replied to Other Pages Does Not Load Only / That Loads

Do you have the module mod_rewrite enabled, I'm guessing it is, but check. And show other post answered.

And is your .htaccess file present.

Activity icon

Replied to Tried Hosting On Cpanel And Then Got This Error

Could you show this one as answered, since you started a new post.

Activity icon

Replied to Make The First Word In A Sentence Bold

<p id="ptest" onclick="myfunction()">Kia Sorento</p>

        <script>
            function myfunction() {
                var TextInside = document.getElementById("ptest").innerHTML;
               alert(TextInside);
               var splitstring = TextInside.split(" ");
               var s1 = splitstring[0];
               alert(s1);
               var result = s1.bold();
               var result2 = splitstring[1];
               var finalresult = result + " " + result2;
               document.getElementById("ptest").innerHTML = finalresult;
               
            }

It replaces the whole innerhtml in the tag.

After function, and inspecting element, you get

<p id="ptest" onclick="myfunction()"><b>Kia</b> Sorento</p>