jlrdw

jlrdw

Member Since 3 Years Ago

Experience Points 270,820
Experience
Level
Lessons Completed 86
Lessons
Completed
Best Reply Awards 271
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

15 Jan
1 day ago

jlrdw left a reply on Laravel Ajax POST Is Not Working Properly On Localhost

Really there is no need to post using json, usually you return data to ajax with json. Just post normally. Something like:

$(function () {

        $("#postjq").click(function (event)
        {
            event.preventDefault();
            var $post = {};
            $post.petid = $('#petid').val();
            $post.species = $('#species').val();
            $post._token = document.getElementsByName("_token")[0].value
            $.ajax({
                url: 'petupdate',
                type: 'POST',
                data: $post,
                cache: false,
                success: function (data) {
                    return data;
                },
                error: function () {
                    alert('error handing here');
                }
            });

        });
    });

jlrdw left a reply on Request Always Empty

Have you tried:

dd(json_decode($request->getContent(), true));

jlrdw left a reply on What Directories Should Be Ignored In Git?

Why don't you do what the docs say:

https://nova.laravel.com/docs/1.0/installation.html#installing-nova

Hidden Files

When unzipping Nova into your application's nova directory, make sure all of Nova's "hidden" files (such as its .gitignore file) are included.

jlrdw left a reply on How Can I Host Storage On Different Source?

Would it not be an image tag.

jlrdw left a reply on Login Works On Local Server But Not On Production [HELP]

You develop on linux, if so that's not the problem. f you develop on Windows, then check things like class names, etc.

Windows MyController = mycontroller

Linux MyController does not = mycontroller

jlrdw left a reply on Login Works On Local Server But Not On Production [HELP]

Check letter case, linux is case sensitive.

jlrdw left a reply on Can't Change Data After Using Axios

cronix needs a spinner or wait message while he is getting you the answer. Too bad we can't have a nice video while waiting.

jlrdw left a reply on Return User To Page They Logged In From

A redirect doesn't work with Ajax.

jlrdw left a reply on Return User To Page They Logged In From

Are you using Ajax here.

jlrdw left a reply on Using An Array In An SQL Query

I thought you would have needed an array like

$somearray ['test1', 'test2', 'test3']

Didn't realize wherein worked also with an associative array.

Nice to know.

jlrdw left a reply on Using An Array In An SQL Query

Top, I have no idea.

Bottom something like:

->orWhere('ProductGroup', '$searchData[2]')
14 Jan
2 days ago

jlrdw left a reply on How To "export" My Library

You could put it on a GitHub repository and have some instructions.

jlrdw left a reply on Single Page Design & Laravel Form

Is OP referring to an SPA.

jlrdw left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

Well I'm beginning to understand the applicability of what he is referring to and the applicable spec.

I guess he's saying be applicable and not unapplicable.

To the specs applicability that is.

Fortunately a CPU doesn't care if it's pretty or spaghetti code but just my two cents.

I agree to write clean code.

Bottom line everyone be applicable.

jlrdw left a reply on Your Understanding Of What A MySQL Schema Is?

Just curious is this more of a guide to help people.

It's under laravel but laravel is the framework, looks like more of a database thing.

Again just curious no reply is applicable.

jlrdw left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

This seems to be more of a guide to educate people maybe you could shift it over to the guide topic.

jlrdw left a reply on Should I Really Be Gitignoring The Vendor Folder?

@davestead you are totally confused about the vendor folder in laravel. That vendor foder is always available from the laravel github site, and the version in composer determines which version gets pulled in.

So why are you picking at something so simple.

That is true for any supported version, now it may not be the case for an old version 3.

So yes always have a zipped backup of an older version.

jlrdw left a reply on Problem In Uploading Laravel Application.

There is probably a drop-down box where you choose your PHP version have you even tried.

jlrdw left a reply on Passing Multiple Data To Blade Template

You really need to watch some free intro videos, layouts is also a free video.

jlrdw left a reply on OrderBy Doesn't Work With Eloquent WhereHas

I don't think you need both

Open::with('league')
            ->whereHas('league',

This just doesn't look right.

13 Jan
3 days ago

jlrdw left a reply on Add Array=>value To Multi Dimensional Key Function

Something like

$keys = array_keys($myarray);
        for ($i = 0; $i < 2; $i++) {
            foreach ($myarray[$keys[$i]] as $key => $value) {
                echo $keys[$i] . " : " . $value . "<br>";
            }
        }

Where I have less than two would be replace with array count.

jlrdw left a reply on Image Is Not Showing In Index Page From Admin Panel

If you use full url does it work.

jlrdw left a reply on Return User To Page They Logged In From

If auth fails use the back helper, otherwise the intended. An if construct will be needed.

jlrdw left a reply on Return User To Page They Logged In From

You said:

I'd like to push my users back to the page they logged in or registered from.

Wow I can't believe I misunderstood that sentence.

jlrdw left a reply on Return User To Page They Logged In From

Have you tried:

return back();

jlrdw left a reply on Manual Auth Login

Sorry didn't realize another table was used.

jlrdw left a reply on Manual Auth Login

Auth::loginUsingId($user->id);

Where is id, user isn't logged in yet, but you are looking up phone numbers, not id.

jlrdw left a reply on Manual Auth Login

Have you added those fields to the user table and in controller added the method to return the fields needed.

jlrdw left a reply on Add Array=>value To Multi Dimensional Key Function

Couldn't you use the

${$variable} = $value; //technique:
   public  function whatever($data = array())
    {
        if (!empty($data)) {
            foreach ($data as $variable => $value) {
                ${$variable} = $value;
            }
            unset($variable, $value);
        }

        // more code
    }

Then do whatever with the array.

jlrdw left a reply on How To Create Facades On Laravel 5.7 Package

If what you are doing isn't to large, you could probably just use a class with __callStatic. So much easier.

jlrdw left a reply on Session Array Basic Usage

Another technique is to build an array first:

$company = array(
            "name" => 'Acme Widgets',
            "phone" => '915-999-9999'
        );

Put array in session:

Session::put('company', $company);

Which makes the loop easier:

foreach (Session::get('company') as $key => $value) {
            echo $key . " : " . $value . "<br>";
        }

Which also produces:

name : Acme Widgets
phone : 915-999-9999

jlrdw left a reply on Append Query String To URL

Take a sabbatical away from laravel and learn the basics of post, get, and how HTML and HTTP works.

jlrdw left a reply on Using Variables In Controllers

Each division needs its own ID.

jlrdw left a reply on Pagination For Search Results Laravel 5.7

Don't forget to append your parameters either in the query string or as pretty URL.

You don't show the whole controllrr method hard to see what you are doing.

jlrdw left a reply on User Registration Without Email

It's right in the docs, I quote:

Username Customization

By default, Laravel uses the email field for authentication. If you would like to customize this, you may define a username method on your LoginController:

public function username()
{
    return 'username';
}

https://laravel.com/docs/5.7/authentication

Change view to match.

12 Jan
4 days ago

jlrdw left a reply on Session Array Basic Usage

Plus what Snapey said, sometimes you need to loop over the array, This is how I do it:

$myarray = Session::get('company');
        $keys = array_keys($myarray);
        for ($i = 0; $i < 2; $i++) {
            foreach ($myarray[$keys[$i]] as $key => $value) {
                echo $keys[$i] . " : " . $value . "<br>";
            }
        }

Which produces:

name : Acme Widgets
phone : 915-999-9999

Of course you can use ul li, tr td, etc. Or however you display things.

I seldom need session array, but at times there are questions on it.

jlrdw left a reply on Show @click="" Only If IsAdmin() Is True Without Repeating Myself. Getting Syntax Error.

Would be easy building the input from a static helper method. I would't, just saying it's possible. Nothing is wrong with using an if else construct. But the ternary that @realrandyallen showed should work.

<input type="checkbox" name="adopted" id="adopted" value="1"<?php echo ($cat->adopted == 1 ? ' checked' : ''); ?>>
<?php
                if ($quy->adopted == 1) {
                    echo "<td>";
                    echo "<input type=\"checkbox\" name=\"adopted\" id=\"adopted\" value=\"1\" checked />";
                    echo "</td>";
                } else {
                    echo "<td>";
                    echo "<input type=\"checkbox\" name=\"adopted\" id=\"adopted\" />";
                    echo "</td>";
                }
 ?>

Both do the same, but top one is shorter. Ternary statements are easier, but there are times not to use ternary.

jlrdw started a new conversation Session Array Usage

Some folks new to Laravel have questions about session array's. This is just a basic example of usage. And I like the facade better, so add the use statement:

use Illuminate\Support\Facades\Session;

Suppose you wanted to store a companies name and phone, you would:

        Session::push('company.name', 'Acme Widgets');
        Session::push('company.phone', '915-999-9999');

And somewhere in the app you needed the phone:

    echo Session::get('company.phone.0');
   // use blade or php as desired

Again just a very basic example.

11 Jan
5 days ago

jlrdw left a reply on Website Hosting Automation

You need a large Bank of servers from that sort of thing, and they cost could be in the hundreds of thousands of dollars.

Are you sure you don't need a multi-tenant application.

And I would imagine rather than asking about that here you could probably get more results from a good Google search.

jlrdw left a reply on Should I Really Be Gitignoring The Vendor Folder?

Yes, if something goes wrong, you can always delete the vendor folder and do a

composer update
// or
composer install

Which re-creates the vendor folder.

jlrdw left a reply on Object Of Class App\\Repository\\UserRepository Could Not Be Converted To String

I'm very grateful for this. Solved it brilliantly.

Could you mark the answer that helped as answered to further assist others.

jlrdw left a reply on Query Help

Not seeing everything, but a count of people signed up for a date, then increment it by one. And an if construct to halt it at 25. Maybe an extra field to determine if haulted. Like if that field says haulted, display a message that the event is full.

jlrdw left a reply on Mysql Program With Live Update Of Tables

Is there a program or way to update the program when things change?

What are you talking about, can you explain better.

jlrdw left a reply on Where To Put Javascript?

I usually load it in my layout file.

jlrdw left a reply on Where To Put Javascript?

I usually put a small script like that at the bottom of the view page.

But you still have to load the JavaScript library, unless you're using raw JavaScript.