jlrdw

jlrdw

Member Since 4 Years Ago

Experience Points
408,680
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
148
Lessons
Completed
Best Reply Awards
432
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 50
408,680 XP
Nov
12
19 hours ago
Activity icon

Replied to Parameter To Database Seeder

Yes look in the documentation and find database transactions it's listed under the database chapter.

https://laravel.com/docs/6.x/database#database-transactions

If you have never used transactions, wouldn't hurt to Google that subject and read more about MySQL and database transactions.

Activity icon

Replied to Parameter To Database Seeder

Why would a seeder be needed to create a new user. Are you referring to each new user has their own unique table. Sorry if I am mis-understanding something.

Activity icon

Replied to Login Function Doesn't Validate

Consider using laravel, regular pdo can be used in laravel. Just a suggestion.

Activity icon

Awarded Best Reply on Login Function Doesn't Validate

Like where you have

    if(empty($username))
    {
        $username_error = "<p>Please enter your username!</p>";
    }

Instead put a message in session "username required" named err_username. Just example.

redirect to the login form, and if the session has err_username, display label in red under username field

"username required".

The login form just needs some conditional if else statements to handle errors.

Just fyi, been a while since I messed with non mvc php, quite a while.

Activity icon

Replied to Login Function Doesn't Validate

Like where you have

    if(empty($username))
    {
        $username_error = "<p>Please enter your username!</p>";
    }

Instead put a message in session "username required" named err_username. Just example.

redirect to the login form, and if the session has err_username, display label in red under username field

"username required".

The login form just needs some conditional if else statements to handle errors.

Just fyi, been a while since I messed with non mvc php, quite a while.

Activity icon

Replied to GroupBy Specific Key And Return The Collection

You need to write an eloquent query or a regular query that does a group by by account_id.

Also you already have that in a nice array if that's all you need.

Activity icon

Replied to How To Define Two Foreign Key Columns To The Same Table In A Migrations File

The on('users') just use same table name. That's very common in logistics software, you have pickups and drops, thus two equal child tables.

But I would normally write a special delete query for this type relation, delete all children first, then delete parent.

But that's up to you how to handle deleting.

Activity icon

Replied to Login Function Doesn't Validate

You have to store an error message in session, and on the failed login form use an if statement to see if an error was passed in the session. Have a label under failed field that shows, for example, wrong password entered.

The label will only show if an error, so it's in an if statement.

From what you show above, that should point you in the correct direction. Basically make your own flash error message.

Activity icon

Replied to Login Function Doesn't Validate

If @snapey is correct, then @gacho I recommend you install a fresh laravel and let's get going. Laravel is very flexible and easy to use. Flexibility is why I like it, you can do things the "laravel way" or the php / pdo way yet have the benefits of the mvc, controllers, models, views, etc.

I for example do use laravel authentication to login, but have custom code for authorization that works with roles. I do not recommend someone new to programming to use custom authorization, but only a programmer with experience in RBAC.

That was just an example.

Activity icon

Replied to Database Relationship With Json Id To Others Table ID

Are you showing this, or is there a question.

Activity icon

Replied to Update From Laravel 5.8 To 6.5.0

In all actuality it doesn't hurt just to do a brand new install, and just migrate your existing code over like models controllers views etc.

It only takes a little while longer.

Take note 6.0 has the new UI.

But that's covered in the documentation.

Activity icon

Replied to Login Function Doesn't Validate

First I would highly advise using out of box Authentication it works great and properly returns back to the login form if there are errors.

However if you are using custom validation you need to reread the chapter on validation and do a proper redirect back with the correct flash messages to show the errors.

In his introductory free videos he gives examples of this

Activity icon

Replied to Login Function Doesn't Validate

Fix code by using laravel request for a first step and using the PDO is fine as long as you bind the parametets as like you are doing.

Even eloquent runs that stuff in the same PDO code , it's converted to regular PDO at runtime.

There's the getPdo () instance.

Also you need to break that up into model and controller.

Activity icon

Awarded Best Reply on Learning E-commerce Using Laravel

If you already know laravel pretty well, one idea is to look at a couple of good packages on GitHub on eCommerce and browse source code to give you ideas.

Activity icon

Replied to Store Image

If you are storing images for users you should have a child table for the images with user_id as a foreign key.

It's hard to know exactly what you need because it's your database.

Some people even have a separate folder for each uses images, it depends on how secure these images need to be.

image the same name you gave the actual file, but that name also has to be stored in the database.

Activity icon

Replied to WithTrashed

@davy_yg if you want to see your query results, but include what is soft deleted, well that's what that does.

@jaytee are you having fun yet.

@davy_yg but he is correct please read and study those documentation examples, as they explain this stuff.

Nov
11
1 day ago
Activity icon

Replied to Store Image

You need to store the filename in a database field. Like myimage.jpg.

I use the asset helper to display images.

The actual file is stored in the file system you're just using image tag to display the image.

Put another way you still have to save a database record in conjunction with the upload, that tutorial must be just how to upload.

Activity icon

Replied to Store Image

That is code to store an image just make sure the path is correct.

Activity icon

Replied to Custom Text For Confirmation Undefined Method ConfirmText()

In the docs example: quote

public function actions(Request $request)
{
    return [
        (new Actions\ActivateUser)
            ->confirmText('Are you sure you want to activate this user?')
            ->confirmButtonText('Activate')
            ->cancelButtonText("Don't activate"),
    ];
}

endquote

You are probably missing this line:

 (new Actions\ActivateUser)

Study the example again.

Activity icon

Replied to How To Unistall Package Which I've Already Installed ?

@ebrahemsamer if this has been answered, to where it helps you. Could you please mark it as answered. Much appreciated.

Activity icon

Replied to Syntax In If-statement Condition

@amit123 is there any way you can show this answered, I just read through all the replies, got down to the bottom, not realizing it was resolved.

Activity icon

Replied to What Is DOM Manipulation In JS?

@khalid_hussain did you take the suggestion and look at a tutorial.

Activity icon

Replied to Group By Parent_id

first, not your data here but an example of an eloquent groupby query:

$quy = Powner::query()->leftJoin('dc_pets', 'dc_powners.ownerid', '=', 'dc_pets.ownerid')
                ->select('dc_powners.ownerid', 'dc_powners.oname')
                ->selectRaw('count(dc_pets.petid) as countOfPets')
                ->groupby('dc_powners.ownerid')
                ->orderby('dc_powners.oname')
                ->get();

Results basically give:

ownerid, oname, countOfPets

Like:

5|Bob|3
4|Greg|9
2|Rob|1

You probably need just need to work out a query where you show a warehouse with product and count to start with:

pseudocode

Foreach warehouse_id
       product_id  | product_name | product_count

Then a routine can be written to pick which ware house to "build" the order from.

Have a "pending" field somewhere. Save the order to the db, and once fulfilled and once pending changes to complete, use yet another routine to update the stock (quantity) of each product.

Not having that system to work with it's hard to guess.

Also REMEMBER, these complex queries can take some trial and error to figure out.

Note, you may need a nested group by, i.e., a grouping by warehouse, sub group by products. But more than one way.

Activity icon

Replied to Taking Sql DB Backup Through Custom Artisan Cammand

My example of course only backs up a database not the application.

Sorry I thought that's what O.P. was after. Spatie also takes a dump of the database.

I just use a bitbucket repo to actually backup the app, I just keep a good copy there.

And yes it works.

Activity icon

Replied to Taking Sql DB Backup Through Custom Artisan Cammand

I have done this:

    public function backup()
    {
        $this->chklogin();  // custom framework not laravel
        include ROOTUP . 'dbconfig.php';  
        $mysqlExportPath = 'myback_';
        $date = date("Y-m-d-H-i-s");
        $command = 'mysqldump --opt -h' . $mysqlHostName . ' -u' . $mysqlUserName . ' -p' . $mysqlPassword . ' ' . $mysqlDatabaseName . ' > ../../' . $mysqlExportPath . $date . '.sql';
        exec($command, $output = array(), $worked);
        switch ($worked) {
            case 0:
                echo 'Database successfully exported;
                break;
            case 1:
                echo 'There was a warning during export';
                break;
            case 2:
                echo 'There was an error during export;
                break;
        }
        
        //  redirect somewhere as needed.
    }

Goes without saying adjust

 ../../

as needed.

Activity icon

Replied to Is It A Good Thing To Have Many Textarea ?

Is there fields to store this extra data, or is it in a related table with something like article_id. And how do you plan on showing in an edit situation. You will need a foreach loop.

Activity icon

Replied to Is It A Good Thing To Have Many Textarea ?

That depends on your use case.

For example I have seen some forms where if you answer yes then there's a text area to please explain if answer was yes.

Don't overthink this stuff just use as needed.

Activity icon

Replied to Connexion Database

Also are you aware that Jeffrey has free video lessons and he covers basic crud.

Activity icon

Replied to Group By Parent_id

Have you seen and or worked some of the examples here: https://laravel.com/docs/6.x/queries#ordering-grouping-limit-and-offset

Activity icon

Replied to What Is DOM Manipulation In JS?

Just curious why not take a good Javascript tutorial.

https://www.w3schools.com/js/js_htmldom.asp

Activity icon

Replied to Summernote : Upload Image Only From Server ( Remove Upload Image Via Link)

Then just upload with laravel techniques.

Activity icon

Replied to Update From Laravel 5.8 To 6.5.0

Did you update laravel prior to updating the framework. Especially any changed composer dependencies. Something tells me you skipped this step.

Activity icon

Replied to Checkboxes Are Not Displayed

I would also recommend finding a good tutorial on jQuery that includes dealing with checkboxes.

Activity icon

Awarded Best Reply on Eloquent Make Join With In Operator.

Try whereIn

//part of query
->whereIn('id', [1, 2, 3])
//rest of query
Activity icon

Awarded Best Reply on How To Send Output Screenshot Or Images From My Computer To Question On Laracasts.com

Upload the image on imgur.com

Once uploaded, right click image and click view image.

Copy that URL.

Put that url here in a regular image tag.

Note create an account first on imgur.

Activity icon

Replied to Checkboxes Are Not Displayed

You do know you have to see if a checkbox is checked:

if ($('#imynput').prop('checked')) {
    // do what you need here.
}

And of course if a checkbox is not checked nothing is passed so you have to check for that in the back end using if request has...

Activity icon

Replied to How To Send Output Screenshot Or Images From My Computer To Question On Laracasts.com

Upload the image on imgur.com

Once uploaded, right click image and click view image.

Copy that URL.

Put that url here in a regular image tag.

Note create an account first on imgur.

Activity icon

Awarded Best Reply on Form Helper

@davy_yg that is correct and even Jeffrey highly recommends just using Blade with HTML just like he does in the videos.

Believe me when I say it made things harder to do.

Activity icon

Replied to Trying To Retrieve Corresponding Product Data When Clicking On Product

Have you ever made an image a link, that would be step one finding a small tutorial on doing that.

also if this is a real professional site, I highly suggest one of two things, 1 actually find a good well maintained shopping cart on GitHub and use it or at least view the code on some of them and learn how things work by a study of the code.

Just a suggestion.

But you just use the image as a link no different than like in edit page, just use a route and find the data in the controller really no different than in edit page but you're just using the image instead of a edit or view link button.

Activity icon

Replied to Form Helper

@davy_yg that is correct and even Jeffrey highly recommends just using Blade with HTML just like he does in the videos.

Believe me when I say it made things harder to do.

Activity icon

Replied to Form Helper

@jaytee it's kind of funny, the very second I saw Jeffrey had said that I immediately bookmarked that.

If they won't believe me, surely they'll believe Jeffrey.

Pal, hehe.

Nov
10
2 days ago
Activity icon

Replied to Learning Resource Recommendation For Experienced Software Engineer

A good start is https://spring.io/guides I never used a framework I just did straight servlets, JSP, and and ejb.

Java was MVC anyway but many times for small things I just used servlet and jsp for The View.

I find using jdbc and PDO are very similar with the bindings, etc

But haven't used since 2007.

P.S. I hope I never have to set up a tomcat server again of course the dedicated host had TomEE.

I would imagine in this Modern Age they have easy installers, unlike the old manual setting it up.

Activity icon

Replied to Saving Voucher

But your browser tools will show you exactly the request and responses.

Activity icon

Replied to Form Helper

See this https://laracasts.com/discuss/channels/general-discussion/noob-here

and read @jeffreyway answer, drop the collective and just use html and blade.

Activity icon

Replied to Saving Voucher

The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the web site's server but the server could not be more specific on what the exact problem is.

So as suggested to you in the past, use your browser developer tools and look at what's going on.

Try now to remember to always do that as a first step. That's how most of us figure this stuff out.