jlrdw

jlrdw

Member Since 3 Years Ago

Experience Points 327,610
Experience Level 50

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 100
Lessons
Completed
Best Reply Awards 337
Best Reply
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.

18 May
1 day ago

jlrdw left a reply on How To Update And Edit A Image In Laravel 5.8

@IRANKHOSRAVI - Just one question: In another post you had trouble uploading an image. Not edit, but upload.

So, did you ever get that working?

jlrdw left a reply on I Need Help.

Why not start here:

https://www.w3schools.com/php7/ Then take Jeffrey's free courses.

jlrdw left a reply on Deploying Laravel App On Cpanel Shared Account

when i ssh any php artisan command from terminal on my mac, i'm getting this error...

So your host is fine the problem is on your Mac in your development version.

jlrdw left a reply on Deploying Laravel App On Cpanel Shared Account

If you go to your site and put in

Yoursite.com/.env

Of course replacing Yoursite.com with your site's actual name.

What do you get.

jlrdw left a reply on Having A Very Rough Time Learning Laravel

I would suggest just taking it slow and easy and realize like anyting there's a learning curve involved.

And practice by doing a small crud application.

There's quite a bit to be learned just working the examples in the documentation also.

jlrdw left a reply on Deploying Laravel App On Cpanel Shared Account

Main laravel goes above public_html see

https://laracasts.com/discuss/channels/laravel/next-issue-fonts-and-images-arent-visible

The guide in that link is from snapey, it works correctly.

Otherwise your site is insecure.

17 May
2 days ago

jlrdw left a reply on How To Create Two Columns With @foreach?

@SNAPEY - If you mean allows code to be executed repeatedly, and matched with the OP, I am following your advice.

jlrdw left a reply on What Is The Best Approach For Data Visibility Restriction? (guest,members,subscribers)

@AP3TWE - Well I don't do that, but post here, even if I can't help @snapey and @cronix And @bobbybouwmann and @others are very good with laravel.

Me I came from Java at first and I usually don't write everything like Taylor might. But I've been doing this sice ild dbase 3 in the late 1980's.

Example I use laravel authentication, but have custom helpers to work with that. But I know how to implement RBAC. Iwas even a contributor to another framework.

I do not suggest someone new to write custom helpers, services until they have quite a bit of experience.

Understand when I did java, servlets, jsp, and ejb, there wasn't "out of box stuff". Back then you even wrote your own paginator as example.

And I only did business programming, I did logistics programming at a trucking / loistics company.

I am very "old" school. But I do enjoy trying to help folks. I am semi retired now.

jlrdw left a reply on How To Create Two Columns With @foreach?

In controller do this:

public function index()
{
    $slideshows = Slideshow::latest()->get();
    $services = Service::latest()->get();
    echo '<pre>';
        print_r($services);
        echo '</pre>';
        exit();
    $faqs = Faq::latest()->get();
    return view('Home.index', compact('slideshows', 'services', 'faqs'));
}

I can view a print_r much better than a var_dump. You need to study the exact results you are getting.

jlrdw left a reply on Can't Login Using Custom Field

In your LoginController add:

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

And I am not 100% sure on the, but if that don't work try


Not in the construct function .

And change the forms as well.

jlrdw left a reply on What Is The Best Approach For Data Visibility Restriction? (guest,members,subscribers)

I like query scopes, to fine tune things right in the query:

    public function scopegetPets($query, $petsearch = '')
    {
        $petsearch = $petsearch . "%";
        $query->where('petname', 'like', $petsearch);
        if (ChkAuth::userRole('admin') === false) {  // custom RBAC
            $userid = Auth::user()->id;
            $query->where('ownerid', '=', $userid);
        }
        $results = $query->orderBy('petname', 'asc')->paginate(5);
        return $results;
    }

Not a spatie example but just example of, if user is an admin they can see all, otherwise

the query only allows a user to see their own data.

Many times roles and permissions are used in conjunction with the way the query s written.

The above I have a custom helper class that works with laravel authentication.

But example was to show how a scope is helpful.

jlrdw left a reply on Someone's Trying To XSS Us With Img Src=x Onerror=prompt(1)

Also to play it extra safe I usually run request through strip_tags.

Something like:

   public static function fixValue($rvalue)
    {
        $rvalue = empty($rvalue) && !is_numeric($rvalue) ? NULL : trim(strip_tags($rvalue));
        return $rvalue;
    }

Not saying to use a static helper like me, use a getter setter or whatever.

It removes those dangerous tags.

jlrdw left a reply on Simple Use Of Eloquent Join

Thanks for the code share.

16 May
3 days ago

jlrdw left a reply on Can't Login Using Custom Field

Did your migration include your field name.

jlrdw left a reply on Loop Through 2 Jason Objects

When it came up once before here is example I gave:

        public function testJson3()
    {

        $data = '[{  
    "id":18296, "pro_number":232231, "driver":"Bettale", "tractor":null, "dateTime":"2018-08-27 07:00:00", "ShipperCustomerName":"ELECTROLUX HOME PRODUCTS", "ConsigneeCustomerName":"LINN STAR", "ShipperName":null, "ConsigneeName":null
},
{  
    "id":18298, "pro_number":232233, "driver":"Bettale", "tractor":null, "dateTime":"2018-08-28 07:00:00", "ShipperCustomerName":"ELECTROLUX HOME PRODUCTS", "ConsigneeCustomerName":"LINN STAR", "ShipperName":null, "ConsigneeName":null
}]';
        $loads = json_decode($data, true);
        $keys = array_keys($loads);
        for ($i = 0; $i < count($loads); $i++) {
            foreach ($loads[$keys[$i]] as $key => $value) {
                echo $key . " : " . $value . "<br>";
            }
        }
    }

Outputs:

id : 18296
pro_number : 232231
driver : Bettale
tractor : 
dateTime : 2018-08-27 07:00:00
ShipperCustomerName : ELECTROLUX HOME PRODUCTS
ConsigneeCustomerName : LINN STAR
ShipperName : 
ConsigneeName : 
id : 18298
pro_number : 232233
driver : Bettale
tractor : 
dateTime : 2018-08-28 07:00:00
ShipperCustomerName : ELECTROLUX HOME PRODUCTS
ConsigneeCustomerName : LINN STAR
ShipperName : 
ConsigneeName : 

jlrdw left a reply on Laravel Saved File To Wrong Directory

See my answer here first:

https://laracasts.com/discuss/channels/laravel/next-issue-fonts-and-images-arent-visible

I usually make a define statement such as:

defined('DS') || define('DS', DIRECTORY_SEPARATOR);
define('ROOTDIR', realpath(__DIR__ .'/../../laravel58up') .DS);
define('ASSET', realpath(dirname(__FILE__)). DS . 'assets' . DS);
// or where ever I want assets, or images.

And uploading:

<form action='add' method='post' enctype="multipart/form-data">
        <table style="border:none; width: 700px;">
            <tr>
                <td>dogpic:</td>
                <td>
                    <input name="ufile" type="file" id="ufile" size="50" /></td>
                </td>
            </tr>
             ///////////// more code for form

controller

           $lid = DB::table('dc_dogs')->count();
            $lid = $lid + 1;
            $file = Request::file('ufile');
            $file_name = $file->getClientOriginalName();
            $file_ext = $file->getClientOriginalExtension();

            $fileInfo = pathinfo($file_name);
            $filename = $fileInfo['filename'];
            $newname = $filename . $lid . "." . $file_ext;
            $destinationPath = ASSET . 'upload/imgdogs'; // use your path here not mine.
            $file->move($destinationPath, $newname);

            $dogpic = $newname;
           
            $dogname = ucfirst(Request::input('dogname'));
            $sex = ucfirst(Request::input('sex'));
            $comments = Request::input('comments');
            $adopted = !empty(Request::input('adopted')) ? '1' : '0';
            $lastedit = date("Y-m-d H:i:s");

            $postdata = array(
                'dogpic' => $dogpic,
                'dogname' => $dogname,
                'sex' => $sex,
                'comments' => $comments,
                'adopted' => $adopted,
                'lastedit' => $lastedit
            );

            DB::table('dc_dogs')->insert($postdata);
           

Never had problems with this.

Validation not shown, so validate your stuff as needed.

jlrdw left a reply on How To Get Count From Select Query ?

If you are new to programming you should seriously consider taking a SQL basic course or tutorial.

http://www.mysqltutorial.org/basic-mysql-tutorial.aspx

jlrdw left a reply on Laracast Possibility Of Adding Friend

Well good and bad. Sometimes an experienced programming can come on strong when a newbee isn't trying. In your case, in that earlier question, I could tell you tried, thus I really wanted to help.

But the "how to do that" with no code questions can be a little nerving.

I know I have as as others on the forum have given some stern answers.

I try to remember what Jeffrey once said to me:

"We were all new to this at one time". But even a newbee can try and have code they tried.

So By some I am liked, but others not, maybe just because they did not like an honest answer.

Some ask a question, yet the answer is right in the docs, and they have viewed no free videos.

So it's hard to say.

jlrdw left a reply on Create Once And Continuous Update Balance Amount Column

when the sales is performing the balance is decrease or increase, so i want to update when the sales is updating, not to create multiple rows again

That never works out, what if a previous record is edited.

See this and search mysql running sum or running total column.

jlrdw left a reply on Making A Route Public For Anyone To View

you have to check the role and see if they are admin.

That's why I mentioned scopes because one query for admin, yet another condition if it's the patient.

jlrdw left a reply on Making A Route Public For Anyone To View

You could probably do this check right in the controller, me I like doing it in a query scope.

@snapey is the one who got me hooked on query scopes they work wonderfully.

All you're doing is making sure an ID that you're using in the query matches up with the authorized users ID I imagine this case it would be the patient.

Unfortunately I'm busy it will be a while before I get to laptop.

jlrdw left a reply on Making A Route Public For Anyone To View

@AP3TWE - Good to see you're taking this very seriously please let us know the final solution and if something worked out for you or not.

Usually this stuff just requires a little trial and error and experimentation to make sure it all is correct.

Once you have solution make sure you thoroughly test and make sure someone else cannot get into that patients information.

jlrdw left a reply on How To Retrieve Env Variable?

Yes I was referring to calling one somewhere else in code.

jlrdw left a reply on How To Retrieve Env Variable?

I thought it was

$var = config('whatever');

jlrdw left a reply on Making A Route Public For Anyone To View

I agree you cannot play around with the security when you are talking about patients.

jlrdw left a reply on Is It Best Practice To Store Role_type In The Session

I don't use that package but see my reply here and there's some other links that talk about authentication and authorization which may give you some ideas.

All of the various RBAC packages are going to be somewhat similar just implemented a little different.

https://laracasts.com/discuss/channels/laravel/multi-auth-login-with-single-table-user-using-middleware-in-laravel

jlrdw left a reply on Is It Best Practice To Store Role_type In The Session

You really need to watch Jefferies at least free video where he covers basic authentication and authorization.

15 May
4 days ago

jlrdw left a reply on Making A Route Public For Anyone To View

When you say doctor and form, you're not letting other patients see another patients information are you.

As I said that's what the authenticated user ID comes in.

If the authenticated users ID doesn't match the id in the record then they don't need to be viewing it..

On mobile now I will go to laptop.

jlrdw left a reply on Assign A 0 To A Null Value In A Request Array

You are so overthinking this wow.

If you have a default of default(0),

It will Store zero if nothing is passed.

And you were already shown how to make an empty request there turn into a 0 if that's what you are after.

How many possible other ways can this thing be answered.

jlrdw left a reply on Assign A 0 To A Null Value In A Request Array

'required'

If it can be a 0 anyway, and you in code are handling the 0, it doesn't make sence to validate it that way. The code ensures it will be there as a 0 or higher.

jlrdw left a reply on Assign A 0 To A Null Value In A Request Array

Does it work correctly if you comment out the

\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,

jlrdw left a reply on Simple Use Of Eloquent Join

Good job so far. If you could also add in group by, Many times a join is used with a group by followed by order by for reports. Example monthly income, expense, A/R, A/P, etc that sort of thing.

For one example report see https://laracasts.com/discuss/channels/guides/getpdo-usage

Also I just gave a quick answer a while back to someone looking for join and group by together.

This is just an example:

$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
// more

Thank's for giving back to the community.

jlrdw left a reply on How To Follow The "How To Manage An Open Source Project" Series?

Sorry I misunderstood then can you mark As answered.

jlrdw left a reply on How To Update A Product In Laravel 5,8

As I mentioned before you need to learn how and make sure you fully understand how to upload an image prior to doing anything else now.

Are you currently able to upload an image and is it in the correct folder.

jlrdw left a reply on How To Follow The "How To Manage An Open Source Project" Series?

Can the project built in the Let's Build A Forum with TDD" series be provided?

Given a link what more do you want.

jlrdw left a reply on Making A Route Public For Anyone To View

If there is a chance of that, I'd have it in an authenticated route as well and verify with Auth::user()->id

jlrdw left a reply on Undefined Index

Could you mark as solved so others know. Others will read over all this to see if they can help only to discover it's solved.

jlrdw left a reply on Bootstrap

Have you gone to

https://getbootstrap.com/docs/4.3/examples/

and read over their docs.

jlrdw left a reply on Composer Laravel Installer Permission Denied On Windows 10

Get the windows installer version of composer.

And you run composer from the folder you plan on doing the install of laravel in.

14 May
5 days ago

jlrdw left a reply on UNSW澳洲毕业证成绩单购买新南威尔士大学毕业信Q/微993398773高仿文凭UNSW教育部认证留信认证UNSW修改GPA成绩UNSW澳洲本科学历UNSW硕士学位

I see we have more spam it's a shame people can't find something better to do with their time, maybe go volunteer at a non-profit.

jlrdw left a reply on Laravel, Update Data In Real Time

I am a new programmer in Laravel.

I wouldn't worry about a cart just yet. Probably take the time to learn proper security first:

  • Authentication
  • Authorization
  • API Authentication if a mobile app also

Have you studied how to receive money, how you don't store credit card on your server, that stuff is handled by the Service who you set up to deal with the transactions.

Just saying if new, make sure all bases are covered.

jlrdw left a reply on SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'product_id' Cannot Be Null (SQL: Insert Into `category_product`

Really no need for the fool word, and instead just let them know why their answers are wrong and ask if they could give better answers.

Just my 1.5 cents.

jlrdw left a reply on Errors White Deploying Laravel Application On CPanle Shared Hosting Account

7.2 with laravel 5.8 upgrade from 5.6 then 5.7 to 5.8

First of course "backup"

You have to update laravel (app) firsrt. Follow the update or upgrade instructions for each version.

Me, I have a program that I can see the changes, and what to update:

Don't just grab laravel from github, get it here:

https://github.com/laravel/laravel/releases

That way you know you have a stable release.

After updating the app (laravel), then run composer update, which will update the framework.

jlrdw left a reply on How To Store Upload An Image?

I have no idea why your image is not uploading.

Until you figure it out only upload an image nothing else in the request.

Get that problem resolved first.

Echo out that path make sure it's correct check your folder permissions, etc.

jlrdw left a reply on Laracasts Search

@snapey how daft.

jlrdw left a reply on Laracasts Search

@MIDWESTDEV - I read Jefferies reply real good and was looking for my name in there I guess he had nothing against my Google search idea.

All I have to say to Jeffrey about his site design, I like the blue.